Skip to content

Commit 1b396d6

Browse files
Revert "[CUDNN] Remove defunct cuDNN V8 API build flag (pytorch#120006)"
This reverts commit ee4cafa. Reverted pytorch#120006 on behalf of https://github.com/huydhn due to Sorry for reverting your change but it is failing ROCm jobs in trunk https://hud.pytorch.org/pytorch/pytorch/commit/ee4cafa098ede2d9546016223cbc1a522ea3630a ([comment](pytorch#120006 (comment)))
1 parent 848fce3 commit 1b396d6

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

cmake/Summary.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function(caffe2_print_configuration_summary)
7474
message(STATUS " Split CUDA : ${BUILD_SPLIT_CUDA}")
7575
message(STATUS " CUDA static link : ${CAFFE2_STATIC_LINK_CUDA}")
7676
message(STATUS " USE_CUDNN : ${USE_CUDNN}")
77+
message(STATUS " USE_EXPERIMENTAL_CUDNN_V8_API: ${USE_EXPERIMENTAL_CUDNN_V8_API}")
7778
message(STATUS " USE_CUSPARSELT : ${USE_CUSPARSELT}")
7879
message(STATUS " CUDA version : ${CUDA_VERSION}")
7980
message(STATUS " USE_FLASH_ATTENTION : ${USE_FLASH_ATTENTION}")

defs.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ default_compiler_flags = [
3333
"-DTH_INDEX_BASE=0",
3434
"-DMAGMA_V2",
3535
"-DNO_CUDNN_DESTROY_HANDLE",
36+
"-DUSE_EXPERIMENTAL_CUDNN_V8_API", # enable cudnn v8 api
3637
"-DUSE_FBGEMM",
3738
"-DUSE_QNNPACK",
3839
"-DUSE_PYTORCH_QNNPACK",

test/quantization/core/test_quantized_op.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import torch.testing._internal.hypothesis_utils as hu
2222
hu.assert_deadline_disabled()
2323

24-
from torch.testing._internal.common_cuda import SM80OrLater
2524
from torch.testing._internal.common_utils import TestCase
2625
from torch.testing._internal.common_utils import IS_PPC, TEST_WITH_UBSAN, IS_MACOS, BUILD_WITH_CAFFE2, IS_SANDCASTLE
2726
from torch.testing._internal.common_quantization import skipIfNoFBGEMM, skipIfNoQNNPACK, skipIfNoONEDNN
@@ -32,7 +31,7 @@
3231
qengine_is_onednn,
3332
)
3433
from torch.ao.quantization import PerChannelMinMaxObserver
35-
from torch.testing._internal.common_cuda import TEST_CUDNN, TEST_CUDNN_VERSION, TEST_CUDA
34+
from torch.testing._internal.common_cuda import TEST_CUDNN, TEST_CUDA
3635
from torch.testing._internal.optests import opcheck
3736
import torch.backends.xnnpack
3837

@@ -906,7 +905,9 @@ def test_qadd_relu_same_qparams(self):
906905
"""Tests the correctness of the cudnn add and add_relu op
907906
(Similar to test_qadd_relu_different_qparams, will probably merge in the future)"""
908907
@unittest.skipIf(not TEST_CUDNN, "cudnn is not enabled.")
909-
@unittest.skipIf(not SM80OrLater, "requires sm80 or later.")
908+
@unittest.skip("Local only - currently the test_qadd_relu_cudnn op is bulid "
909+
"with USE_EXPERIMENTAL_CUDNN_V8_API, we can enable the test "
910+
"after it is built by default")
910911
def test_qadd_relu_cudnn(self):
911912
dtype = torch.qint8
912913
add_relu = torch.ops.quantized.add_relu
@@ -939,7 +940,9 @@ def test_qadd_relu_cudnn(self):
939940

940941
"""Tests the correctness of the cudnn add and add_relu op for nhwc format"""
941942
@unittest.skipIf(not TEST_CUDNN, "cudnn is not enabled.")
942-
@unittest.skipIf(not SM80OrLater, "requires sm80 or later.")
943+
@unittest.skip("Local only - currently the test_qadd_relu_cudnn_nhwc op is bulid "
944+
"with USE_EXPERIMENTAL_CUDNN_V8_API, we can enable the test "
945+
"after it is built by default")
943946
def test_qadd_relu_cudnn_nhwc(self):
944947
dtype = torch.qint8
945948
add_relu = torch.ops.quantized.add_relu
@@ -1376,7 +1379,7 @@ def test_max_pool1d(self, X, kernel, stride, dilation, padding, ceil_mode):
13761379
self.assertEqual(a_ref, a_hat.dequantize(),
13771380
msg="ops.quantized.max_pool1d results are off")
13781381

1379-
# TODO: merge this test with test_max_pool2d
1382+
# TODO: merge this test with test_max_pool2d when USE_EXPERIMENTAL_CUDNN_V8_API flag is enabled in CI
13801383
"""Tests 2D cudnn max pool operation on quantized tensors."""
13811384
@given(X=hu.tensor(shapes=hu.array_shapes(min_dims=3, max_dims=4,
13821385
min_side=1, max_side=10),
@@ -1391,7 +1394,9 @@ def test_max_pool1d(self, X, kernel, stride, dilation, padding, ceil_mode):
13911394
padding=st.integers(0, 2),
13921395
ceil_mode=st.booleans())
13931396
@unittest.skipIf(not TEST_CUDNN, "cudnn is not enabled.")
1394-
@unittest.skipIf(TEST_CUDNN_VERSION <= 90100, "cuDNN maxpool2d mishandles -128 before v90100")
1397+
@unittest.skip("Local only - currently the qconv2d_cudnn op is bulid "
1398+
"with USE_EXPERIMENTAL_CUDNN_V8_API, we can enable the test "
1399+
"after it is built by default")
13951400
def test_max_pool2d_cudnn(self, X, kernel, stride, dilation, padding, ceil_mode):
13961401
X, (scale, zero_point, torch_type) = X
13971402
assume(kernel // 2 >= padding) # Kernel cannot be overhanging!
@@ -4045,7 +4050,9 @@ def test_qlinear_with_input_q_dq_qweight_dq_output_fp32(
40454050
use_channelwise=st.sampled_from([False])) # channelwise currently not supported for qlinear cudnn
40464051
@skipIfNoFBGEMM
40474052
@unittest.skipIf(not TEST_CUDNN, "cudnn is not enabled.")
4048-
@unittest.skipIf(not SM80OrLater, "requires sm80 or later.")
4053+
@unittest.skip("Local only - currently the qlinear_cudnn op is bulid "
4054+
"with USE_EXPERIMENTAL_CUDNN_V8_API, we can enable the test "
4055+
"after it is built by default")
40494056
# TODO: check with yang regarding CUDNN flags
40504057
def test_qlinear_cudnn(self, batch_size, input_channels, output_channels, use_bias,
40514058
use_relu, use_multi_dim_input, use_channelwise):
@@ -5420,7 +5427,9 @@ def test_qconv2d_add_relu(self):
54205427
use_channelwise=st.sampled_from([False]))
54215428
@skipIfNoFBGEMM
54225429
@unittest.skipIf(not TEST_CUDNN, "cudnn is not enabled.")
5423-
@unittest.skipIf(not SM80OrLater, "requires sm80 or later.")
5430+
@unittest.skip("Local only - currently the qconv2d_cudnn op is bulid "
5431+
"with USE_EXPERIMENTAL_CUDNN_V8_API, we can enable the test "
5432+
"after it is built by default")
54245433
def test_qconv2d_cudnn(
54255434
self,
54265435
batch_size,
@@ -5501,7 +5510,9 @@ def test_qconv2d_cudnn(
55015510
use_channelwise=st.sampled_from([False]))
55025511
@skipIfNoFBGEMM
55035512
@unittest.skipIf(not TEST_CUDNN, "cudnn is not enabled.")
5504-
@unittest.skipIf(not SM80OrLater, "requires sm80 or later.")
5513+
@unittest.skip("Local only - currently the qconv2d_cudnn op is bulid "
5514+
"with USE_EXPERIMENTAL_CUDNN_V8_API, we can enable the test "
5515+
"after it is built by default")
55055516
def test_qconv2d_relu_cudnn(
55065517
self,
55075518
batch_size,
@@ -6234,7 +6245,9 @@ def test_qconv1d_relu(
62346245
use_channelwise=st.sampled_from([False]))
62356246
@skipIfNoFBGEMM
62366247
@unittest.skipIf(not TEST_CUDNN, "cudnn is not enabled.")
6237-
@unittest.skipIf(not SM80OrLater, "requires sm80 or later.")
6248+
@unittest.skip("Local only - currently the qconv1d_cudnn op is bulid "
6249+
"with USE_EXPERIMENTAL_CUDNN_V8_API, we can enable the test "
6250+
"after it is built by default")
62386251
def test_qconv1d_cudnn(
62396252
self,
62406253
batch_size,
@@ -6306,7 +6319,9 @@ def test_qconv1d_cudnn(
63066319
use_channelwise=st.sampled_from([False]))
63076320
@skipIfNoFBGEMM
63086321
@unittest.skipIf(not TEST_CUDNN, "cudnn is not enabled.")
6309-
@unittest.skipIf(not SM80OrLater, "requires sm80 or later.")
6322+
@unittest.skip("Local only - currently the qconv1d_cudnn op is bulid "
6323+
"with USE_EXPERIMENTAL_CUDNN_V8_API, we can enable the test "
6324+
"after it is built by default")
63106325
def test_qconv1d_relu_cudnn(
63116326
self,
63126327
batch_size,

0 commit comments

Comments
 (0)