提交 c0e915a2 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Remove checks for unsupported versions.

上级 f8c749ee
...@@ -439,22 +439,6 @@ class GpuDnnConv(DnnBase): ...@@ -439,22 +439,6 @@ class GpuDnnConv(DnnBase):
if self.inplace: if self.inplace:
self.destroy_map = {0: [2]} self.destroy_map = {0: [2]}
if version() < 3000:
if self.algo == 'fft':
raise RuntimeError("cuDNN FFT convolution requires cuDNN v3")
elif self.algo in ['guess_once', 'guess_on_shape_change']:
raise RuntimeError("cuDNN selection of convolution "
"implementation based on heuristics "
"requires cuDNN v3")
elif self.algo in ['time_once', 'time_on_shape_change']:
raise RuntimeError("cuDNN convolution timing requires cuDNN v3")
# The fft_tiling implementation is only available from cuDNN V4 onward
if version() < 4000:
if self.algo == 'fft_tiling':
raise RuntimeError("cuDNN tiled-FFT convolution requires "
"cuDNN v4 or more recent")
if version() < 5000 and self.algo == 'winograd': if version() < 5000 and self.algo == 'winograd':
raise RuntimeError("cuDNN winograd convolution requires " raise RuntimeError("cuDNN winograd convolution requires "
"cuDNN v5 or more recent") "cuDNN v5 or more recent")
...@@ -490,7 +474,6 @@ class GpuDnnConv(DnnBase): ...@@ -490,7 +474,6 @@ class GpuDnnConv(DnnBase):
elif self.algo == 'fft': elif self.algo == 'fft':
alg = 'CUDNN_CONVOLUTION_FWD_ALGO_FFT' alg = 'CUDNN_CONVOLUTION_FWD_ALGO_FFT'
elif self.algo == 'fft_tiling': elif self.algo == 'fft_tiling':
# need v4
alg = 'CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING' alg = 'CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING'
elif self.algo == 'winograd': elif self.algo == 'winograd':
# need v5 # need v5
...@@ -652,26 +635,23 @@ class GpuDnnConvGradW(DnnBase): ...@@ -652,26 +635,23 @@ class GpuDnnConvGradW(DnnBase):
if self.inplace: if self.inplace:
defs.append(('CONV_INPLACE', '1')) defs.append(('CONV_INPLACE', '1'))
if version() < 3000: alg = 'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0'
alg = '0' if self.algo == 'none':
else:
alg = 'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0' alg = 'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0'
if self.algo == 'none': if self.algo == 'deterministic':
alg = 'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0' alg = 'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1'
if self.algo == 'deterministic': if self.algo == 'fft':
alg = 'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1' alg = 'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT'
if self.algo == 'fft': if self.algo == 'small':
alg = 'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT' # non-deterministic, small workspace
if self.algo == 'small': alg = 'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3'
# non-deterministic, small workspace if self.algo in ['guess_once', 'guess_on_shape_change',
alg = 'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3' 'time_once', 'time_on_shape_change']:
if self.algo in ['guess_once', 'guess_on_shape_change', defs.append(('CHOOSE_ALGO', ''))
'time_once', 'time_on_shape_change']: if self.algo in ['guess_once', 'time_once']:
defs.append(('CHOOSE_ALGO', '')) defs.append(('CHOOSE_ONCE', ''))
if self.algo in ['guess_once', 'time_once']: if self.algo in ['time_once', 'time_on_shape_change']:
defs.append(('CHOOSE_ONCE', '')) defs.append(('CHOOSE_TIME', ''))
if self.algo in ['time_once', 'time_on_shape_change']:
defs.append(('CHOOSE_TIME', ''))
defs.append(('CONV_ALGO', alg)) defs.append(('CONV_ALGO', alg))
...@@ -749,11 +729,6 @@ class GpuDnnConvGradI(DnnBase): ...@@ -749,11 +729,6 @@ class GpuDnnConvGradI(DnnBase):
algo = config.dnn.conv.algo_bwd_data algo = config.dnn.conv.algo_bwd_data
self.algo = algo self.algo = algo
# The small-workspace implementation is only available from cuDNN V4
# onward.
if version() < 4000 and self.algo == 'fft_tiling':
raise RuntimeError("cuDNN's tiled-FFT convolution requires cuDNN "
"v4 or more recent")
if version() < 5000 and self.algo == 'winograd': if version() < 5000 and self.algo == 'winograd':
raise RuntimeError("cuDNN's winograd convolution requires cuDNN " raise RuntimeError("cuDNN's winograd convolution requires cuDNN "
"v5 or more recent") "v5 or more recent")
...@@ -792,30 +767,27 @@ class GpuDnnConvGradI(DnnBase): ...@@ -792,30 +767,27 @@ class GpuDnnConvGradI(DnnBase):
if self.inplace: if self.inplace:
defs.append(('CONV_INPLACE', '1')) defs.append(('CONV_INPLACE', '1'))
if version() < 3000: alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0'
alg = '0' if self.algo == 'none':
else:
alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0' alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0'
if self.algo == 'none': elif self.algo == 'deterministic':
alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0' alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_1'
elif self.algo == 'deterministic': elif self.algo == 'fft':
alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_1' alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT'
elif self.algo == 'fft': elif self.algo == 'fft_tiling':
alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT' # big workspace but less than fft
elif self.algo == 'fft_tiling': alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING'
# big workspace but less than fft elif self.algo == 'winograd':
alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING' # need v5
elif self.algo == 'winograd': alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD'
# need v5
alg = 'CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD' if self.algo in ['guess_once', 'guess_on_shape_change',
'time_once', 'time_on_shape_change']:
if self.algo in ['guess_once', 'guess_on_shape_change', defs.append(('CHOOSE_ALGO', ''))
'time_once', 'time_on_shape_change']: if self.algo in ['guess_once', 'time_once']:
defs.append(('CHOOSE_ALGO', '')) defs.append(('CHOOSE_ONCE', ''))
if self.algo in ['guess_once', 'time_once']: if self.algo in ['time_once', 'time_on_shape_change']:
defs.append(('CHOOSE_ONCE', '')) defs.append(('CHOOSE_TIME', ''))
if self.algo in ['time_once', 'time_on_shape_change']:
defs.append(('CHOOSE_TIME', ''))
defs.append(('CONV_ALGO', alg)) defs.append(('CONV_ALGO', alg))
...@@ -1060,12 +1032,6 @@ class GpuDnnPoolDesc(Op): ...@@ -1060,12 +1032,6 @@ class GpuDnnPoolDesc(Op):
self.stride = stride self.stride = stride
self.pad = pad self.pad = pad
if self.get_ndim() == 3 and version() < 3000:
raise RuntimeError("cuDNN 3d pooling requires v3")
if mode == 'average_exc_pad' and max(pad) > 0 and version() < 4004:
raise RuntimeError(
"cuDNN pooling mode 'average_exc_pad' requires at least v4")
def get_ndim(self): def get_ndim(self):
return len(self.ws) return len(self.ws)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论