Skip to content

Commit dbff1f3

Browse files
committed
Merge remote-tracking branch 'rocm_upstream/master'
2 parents ac70c99 + cc253d9 commit dbff1f3

File tree

13 files changed

+77
-43
lines changed

13 files changed

+77
-43
lines changed

.jenkins/pytorch/build.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ if [[ "$BUILD_ENVIRONMENT" == *rocm* ]]; then
3838
# The HIP Utility scripts require these environment variables to be set in order to run without error.
3939
export LANG=C.UTF-8
4040
export LC_ALL=C.UTF-8
41-
export PYTORCH_BUILT_WITH_ROCM=1
4241

4342
# This environment variable enabled HCC Optimizations that speed up the linking stage.
4443
# https://github.com/RadeonOpenCompute/hcc#hcc-with-thinlto-linking
45-
# export KMTHINLTO=1
44+
export KMTHINLTO=1
4645

4746
sudo chown -R jenkins:jenkins /usr/local
4847
rm -rf "$(dirname "${BASH_SOURCE[0]}")/../../../pytorch_amd/" || true

.jenkins/pytorch/test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ if [[ "$BUILD_ENVIRONMENT" == *asan* ]]; then
4444
(cd test && ! get_exit_code python -c "import torch; torch._C._crash_if_aten_asan(3)")
4545
fi
4646

47+
if [[ "$BUILD_ENVIRONMENT" == *rocm* ]]; then
48+
export PYTORCH_TEST_WITH_ROCM=1
49+
fi
50+
4751
if [[ "${JOB_BASE_NAME}" == *-NO_AVX-* ]]; then
4852
export ATEN_CPU_CAPABILITY=default
4953
elif [[ "${JOB_BASE_NAME}" == *-NO_AVX2-* ]]; then

caffe2/CMakeLists.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,24 @@ endif()
262262
# ---[ Caffe2 HIP sources.
263263
if(USE_ROCM)
264264
# Call again since Caffe2_HIP_INCLUDES is extended with ATen include dirs.
265-
IF(BUILD_ATEN)
266-
HIP_INCLUDE_DIRECTORIES(${Caffe2_HIP_INCLUDES})
267-
ENDIF()
265+
if(BUILD_ATEN)
266+
# Get Compile Definitions from the directory (FindHIP.CMake bug)
267+
get_directory_property(MY_DEFINITIONS COMPILE_DEFINITIONS)
268+
if(MY_DEFINITIONS)
269+
foreach(_item ${MY_DEFINITIONS})
270+
LIST(APPEND HIP_HCC_FLAGS "-D${_item}")
271+
endforeach()
272+
endif()
273+
274+
# Call again since Caffe2_HIP_INCLUDES is extended with ATen include dirs.
275+
hip_include_directories(${Caffe2_HIP_INCLUDES})
276+
endif()
268277
IF(BUILD_CAFFE2)
269278
set_source_files_properties(${Caffe2_HIP_SRCS} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
270279
ENDIF()
271-
hip_add_library(caffe2_hip ${Caffe2_HIP_SRCS})
280+
281+
# FindHIP.CMake checks if the SHARED flag is set and adds extra logic accordingly.
282+
hip_add_library(caffe2_hip SHARED ${Caffe2_HIP_SRCS})
272283

273284
# Since PyTorch files contain HIP headers, these flags are required for the necessary definitions to be added.
274285
set_target_properties(caffe2_hip PROPERTIES COMPILE_FLAGS ${HIP_HIPCC_FLAGS})

cmake/public/LoadHIP.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ IF(HIP_FOUND)
111111
set(CMAKE_HIP_ARCHIVE_CREATE ${CMAKE_CXX_ARCHIVE_CREATE})
112112
set(CMAKE_HIP_ARCHIVE_APPEND ${CMAKE_CXX_ARCHIVE_APPEND})
113113
set(CMAKE_HIP_ARCHIVE_FINISH ${CMAKE_CXX_ARCHIVE_FINISH})
114+
SET(CMAKE_HCC_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
115+
SET(CMAKE_HCC_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
114116
### Remove setting of Flags when FindHIP.CMake PR #558 is accepted.###
115117

116118
set(rocrand_DIR ${ROCRAND_PATH}/lib/cmake/rocrand)

test/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _check_module_exists(name):
9292
NO_MULTIPROCESSING_SPAWN = os.environ.get('NO_MULTIPROCESSING_SPAWN', '0') == '1'
9393
TEST_WITH_ASAN = os.getenv('PYTORCH_TEST_WITH_ASAN', '0') == '1'
9494
TEST_WITH_UBSAN = os.getenv('PYTORCH_TEST_WITH_UBSAN', '0') == '1'
95-
BUILT_WITH_ROCM = os.getenv('PYTORCH_BUILT_WITH_ROCM', '0') == '1'
95+
TEST_WITH_ROCM = os.getenv('PYTORCH_TEST_WITH_ROCM', '0') == '1'
9696

9797
if TEST_NUMPY:
9898
import numpy

test/test_autograd.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from torch.autograd.function import once_differentiable
1616
from torch.autograd.profiler import profile
1717
from common import TEST_MKL, TestCase, run_tests, skipIfNoLapack, \
18-
suppress_warnings, skipIfNoZeroSize, BUILT_WITH_ROCM
18+
suppress_warnings, skipIfNoZeroSize, TEST_WITH_ROCM
1919
from torch.autograd import Variable, Function, detect_anomaly
2020
from torch.autograd.function import InplaceFunction
2121
from torch.testing import make_non_contiguous, randn_like
@@ -1573,7 +1573,7 @@ def test_pyscalar_conversions(self):
15731573
self._test_pyscalar_conversions(lambda x: x.cuda(), lambda x: long(x))
15741574

15751575
@unittest.skipIf(not torch.cuda.is_available(), "CUDA unavailable")
1576-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
1576+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
15771577
def test_pin_memory(self):
15781578
x = torch.randn(2, 2, requires_grad=True)
15791579
self.assertEqual(x, x.pin_memory())
@@ -2172,6 +2172,7 @@ def test_where_functional(self):
21722172
self._test_where_functional(lambda t: t)
21732173

21742174
@unittest.skipIf(not torch.cuda.is_available(), "CUDA unavailable")
2175+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
21752176
def test_where_functional_cuda(self):
21762177
self._test_where_functional(lambda t: t.cuda())
21772178

@@ -2381,15 +2382,15 @@ def f3(dt):
23812382
f(dt)
23822383

23832384
@unittest.skipIf(not torch.cuda.is_available(), "CUDA unavailable")
2384-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
2385+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
23852386
def test_set_requires_grad_only_for_floats_cuda(self):
23862387
self._test_set_requires_grad_only_for_floats(self, True)
23872388

23882389
def test_set_requires_grad_only_for_floats(self):
23892390
self._test_set_requires_grad_only_for_floats(self, False)
23902391

23912392
@unittest.skipIf(not torch.cuda.is_available(), "CUDA unavailable")
2392-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
2393+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
23932394
def test_rnn_backward_to_input_but_not_parameters_cuda(self):
23942395
# this checks whether it is possible to not require
23952396
# weight parameters, but require inputs, see #7722

test/test_dataloader.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from torch.utils.data import Dataset, TensorDataset, DataLoader, ConcatDataset
1414
from torch.utils.data.dataset import random_split
1515
from torch.utils.data.dataloader import default_collate, ExceptionWrapper, MANAGER_STATUS_CHECK_INTERVAL
16-
from common import TestCase, run_tests, TEST_NUMPY, IS_WINDOWS, NO_MULTIPROCESSING_SPAWN, BUILT_WITH_ROCM
16+
from common import TestCase, run_tests, TEST_NUMPY, IS_WINDOWS, NO_MULTIPROCESSING_SPAWN, TEST_WITH_ROCM
1717

1818
# We cannot import TEST_CUDA from common_nn here, because if we do that,
1919
# the TEST_CUDNN line from common_nn will be executed multiple times
@@ -335,14 +335,14 @@ def test_growing_dataset(self):
335335
self.assertEqual(len(dataloader_shuffle), 5)
336336

337337
@unittest.skipIf(not TEST_CUDA, "CUDA unavailable")
338-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
338+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
339339
def test_sequential_pin_memory(self):
340340
loader = DataLoader(self.dataset, batch_size=2, pin_memory=True)
341341
for input, target in loader:
342342
self.assertTrue(input.is_pinned())
343343
self.assertTrue(target.is_pinned())
344344

345-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
345+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
346346
def test_multiple_dataloaders(self):
347347
loader1_it = iter(DataLoader(self.dataset, num_workers=1))
348348
loader2_it = iter(DataLoader(self.dataset, num_workers=2))
@@ -443,7 +443,7 @@ def test_batch_sampler(self):
443443
self._test_batch_sampler(num_workers=4)
444444

445445
@unittest.skipIf(not TEST_CUDA, "CUDA unavailable")
446-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
446+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
447447
def test_shuffle_pin_memory(self):
448448
loader = DataLoader(self.dataset, batch_size=2, shuffle=True, num_workers=4, pin_memory=True)
449449
for input, target in loader:
@@ -476,7 +476,7 @@ def test_error_workers(self):
476476

477477
@unittest.skipIf(IS_WINDOWS, "FIXME: stuck test")
478478
@unittest.skipIf(not TEST_CUDA, "CUDA unavailable")
479-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
479+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
480480
def test_partial_workers(self):
481481
"check that workers exit even if the iterator is not exhausted"
482482
loader = iter(DataLoader(self.dataset, batch_size=2, num_workers=4, pin_memory=True))
@@ -530,7 +530,7 @@ def _is_process_alive(pid, pname):
530530
"spawn start method is not supported in Python 2, \
531531
but we need it for creating another process with CUDA")
532532
@unittest.skipIf(not TEST_CUDA, "CUDA unavailable")
533-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
533+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
534534
def test_main_process_unclean_exit(self):
535535
r'''There might be ConnectionResetError or leaked semaphore warning (due to dirty process exit), \
536536
but they are all safe to ignore'''
@@ -634,7 +634,7 @@ def setUp(self):
634634
self.dataset = StringDataset()
635635

636636
@unittest.skipIf(not TEST_CUDA, "CUDA unavailable")
637-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
637+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
638638
def test_shuffle_pin_memory(self):
639639
loader = DataLoader(self.dataset, batch_size=2, shuffle=True, num_workers=4, pin_memory=True)
640640
for batch_ndx, (s, n) in enumerate(loader):
@@ -678,7 +678,7 @@ def test_sequential_batch(self):
678678
self.assertEqual(n[1], idx + 1)
679679

680680
@unittest.skipIf(not TEST_CUDA, "CUDA unavailable")
681-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
681+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
682682
def test_pin_memory(self):
683683
loader = DataLoader(self.dataset, batch_size=2, pin_memory=True)
684684
for batch_ndx, sample in enumerate(loader):
@@ -718,7 +718,7 @@ def _run_ind_worker_queue_test(self, batch_size, num_workers):
718718
if current_worker_idx == num_workers:
719719
current_worker_idx = 0
720720

721-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
721+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
722722
def test_ind_worker_queue(self):
723723
for batch_size in (8, 16, 32, 64):
724724
for num_workers in range(1, 6):

test/test_jit.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from torch.autograd.function import traceable
1010
from torch.testing import assert_allclose
1111
from torch.onnx import OperatorExportTypes
12-
from common import TestCase, run_tests, IS_WINDOWS, TEST_WITH_UBSAN, BUILT_WITH_ROCM
12+
from common import TestCase, run_tests, IS_WINDOWS, TEST_WITH_UBSAN, TEST_WITH_ROCM
1313
from textwrap import dedent
1414
import os
1515
import io
@@ -385,7 +385,7 @@ def forward(self, x):
385385
# TODO: Fuser doesn't work at all when inputs require grad. Fix that
386386
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
387387
@unittest.skipIf(not RUN_CUDA, "fuser requires CUDA")
388-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
388+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
389389
def test_lstm_fusion_cuda(self):
390390
inputs = get_lstm_inputs('cuda')
391391
ge = self.checkTrace(LSTMCellF, inputs)
@@ -409,15 +409,15 @@ def test_lstm_fusion_cpu(self):
409409

410410
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
411411
@unittest.skipIf(not RUN_CUDA, "fuser requires CUDA")
412-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
412+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
413413
def test_lstm_fusion_concat(self):
414414
inputs = get_lstm_inputs('cuda')
415415
ge = self.checkTrace(LSTMCellC, inputs)
416416
self.assertExpectedGraph(ge.graph_for(*inputs))
417417

418418
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
419419
@unittest.skipIf(not RUN_CUDA, "fuser requires CUDA")
420-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
420+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
421421
def test_concat_fusion(self):
422422
hx = torch.randn(3, 20, dtype=torch.float, device='cuda')
423423
cx = torch.randn(3, 20, dtype=torch.float, device='cuda')
@@ -430,7 +430,7 @@ def foo(hx, cx):
430430

431431
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
432432
@unittest.skipIf(not RUN_CUDA, "fuser requires CUDA")
433-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
433+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
434434
def test_fusion_distribute(self):
435435
def f(x, y):
436436
z1, z2 = (x + y).chunk(2, dim=1)
@@ -452,7 +452,7 @@ def fn_test_comparison_gt_lt(x, y):
452452

453453
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
454454
@unittest.skipIf(not RUN_CUDA, "fuser requires CUDA")
455-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
455+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
456456
def test_comparison_gt_lt(self):
457457
x = torch.randn(4, 4, dtype=torch.float, device='cuda')
458458
y = torch.randn(4, 4, dtype=torch.float, device='cuda')
@@ -461,7 +461,7 @@ def test_comparison_gt_lt(self):
461461

462462
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
463463
@unittest.skipIf(not RUN_CUDA, "fuser requires CUDA")
464-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
464+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
465465
def test_comparison_ge_le(self):
466466
def f(x, y):
467467
mask = (x >= 0).type_as(x)
@@ -481,7 +481,7 @@ def fn_test_relu(x, y):
481481

482482
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
483483
@unittest.skipIf(not RUN_CUDA, "fuser requires CUDA")
484-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
484+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
485485
def test_relu(self):
486486
x = torch.randn(4, 4, dtype=torch.float, device='cuda')
487487
y = torch.randn(4, 4, dtype=torch.float, device='cuda')
@@ -504,7 +504,7 @@ def fn_test_exp(x, y):
504504

505505
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
506506
@unittest.skipIf(not RUN_CUDA, "fuser requires CUDA")
507-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
507+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
508508
def test_exp(self):
509509
x = torch.randn(4, 4, dtype=torch.float, device='cuda')
510510
y = torch.randn(4, 4, dtype=torch.float, device='cuda')
@@ -849,7 +849,7 @@ def doit(x, y):
849849

850850
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
851851
@unittest.skipIf(not RUN_CUDA, "cpp tests require CUDA")
852-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
852+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
853853
def test_cpp(self):
854854
# rather than rebuild assertExpected in cpp,
855855
# just glob all the cpp outputs into one file for now
@@ -969,6 +969,7 @@ def test_ge_optimized(self):
969969

970970
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
971971
@unittest.skipIf(not RUN_CUDA, "requires CUDA")
972+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
972973
def test_ge_cuda(self):
973974
self.run_ge_tests(True, True)
974975

@@ -1005,6 +1006,7 @@ def foo(a):
10051006

10061007
@unittest.skipIf(IS_WINDOWS, "NYI: fuser support for Windows")
10071008
@unittest.skipIf(not RUN_CUDA, "calls .cuda()")
1009+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
10081010
def test_traced_module(self):
10091011
class Model(nn.Module):
10101012
def __init__(self, num_features, num_layers):
@@ -2066,7 +2068,7 @@ def test_tensor_number_math(self):
20662068
self._test_tensor_number_math()
20672069

20682070
@unittest.skipIf(not RUN_CUDA, "No CUDA")
2069-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
2071+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
20702072
def test_tensor_number_math_cuda(self):
20712073
self._test_tensor_number_math(device='cuda')
20722074

test/test_optim.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from torch.autograd import Variable
1212
from torch import sparse
1313
from torch.optim.lr_scheduler import LambdaLR, StepLR, MultiStepLR, ExponentialLR, CosineAnnealingLR, ReduceLROnPlateau
14-
from common import TestCase, run_tests, TEST_WITH_UBSAN, BUILT_WITH_ROCM
14+
from common import TestCase, run_tests, TEST_WITH_UBSAN, TEST_WITH_ROCM
1515

1616

1717
def rosenbrock(tensor):
@@ -438,7 +438,7 @@ def test_asgd(self):
438438
with self.assertRaisesRegex(ValueError, "Invalid weight_decay value: -0.5"):
439439
optim.ASGD(None, lr=1e-2, weight_decay=-0.5)
440440

441-
@unittest.skipIf(BUILT_WITH_ROCM, "test doesn't currently work on the ROCm stack")
441+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
442442
def test_rprop(self):
443443
self._test_rosenbrock(
444444
lambda params: optim.Rprop(params, lr=1e-3),

test/test_torch.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from torch import multiprocessing as mp
2323
from common import TestCase, iter_indices, TEST_NUMPY, TEST_SCIPY, TEST_MKL, \
2424
TEST_LIBROSA, run_tests, download_file, skipIfNoLapack, suppress_warnings, \
25-
IS_WINDOWS, PY3, NO_MULTIPROCESSING_SPAWN, skipIfNoZeroSize
25+
IS_WINDOWS, PY3, NO_MULTIPROCESSING_SPAWN, skipIfNoZeroSize, TEST_WITH_ROCM
2626
from multiprocessing.reduction import ForkingPickler
2727

2828
if TEST_NUMPY:
@@ -724,6 +724,7 @@ def test_norm(self):
724724

725725
@unittest.skipIf(not TEST_NUMPY, "Numpy not found")
726726
@unittest.skipIf(not torch.cuda.is_available(), 'no CUDA')
727+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
727728
def test_norm_cuda(self):
728729
self._test_norm(self, device='cuda')
729730

@@ -3249,6 +3250,7 @@ def test_topk_arguments(self):
32493250
self.assertRaises(TypeError, lambda: q.topk(4, True))
32503251

32513252
@unittest.skipIf(not torch.cuda.is_available(), 'no CUDA')
3253+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
32523254
def test_topk_noncontiguous_gpu(self):
32533255
t = torch.randn(20, device="cuda")[::2]
32543256
top1, idx1 = t.topk(5)
@@ -7226,6 +7228,7 @@ def test_serialize_device(self):
72267228
self.assertEqual(device, device_copied)
72277229

72287230
@unittest.skipIf(not torch.cuda.is_available(), 'no CUDA')
7231+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
72297232
def test_half_tensor_cuda(self):
72307233
x = torch.randn(5, 5).half()
72317234
self.assertEqual(x.cuda(), x)
@@ -7541,6 +7544,7 @@ def test_from_file(self):
75417544
t2.fill_(rnum)
75427545
self.assertEqual(t1, t2, 0)
75437546

7547+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
75447548
def test_print(self):
75457549
default_type = torch.Tensor().type()
75467550
for t in torch._tensor_classes:
@@ -7705,6 +7709,7 @@ def test_empty_like(self):
77057709
self.assertEqual(torch.empty_like(a).type(), a.type())
77067710

77077711
@unittest.skipIf(not torch.cuda.is_available(), 'no CUDA')
7712+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
77087713
def test_pin_memory(self):
77097714
x = torch.randn(3, 5)
77107715
self.assertFalse(x.is_pinned())
@@ -7875,6 +7880,7 @@ def test_from_numpy(self):
78757880
self.assertRaises(ValueError, lambda: torch.from_numpy(x))
78767881

78777882
@unittest.skipIf(not TEST_NUMPY, "Numpy not found")
7883+
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
78787884
def test_ctor_with_numpy_array(self):
78797885
dtypes = [
78807886
np.double,

0 commit comments

Comments
 (0)