From 7e9f543af4f8c3968ad17525af8b01b2bc75efd3 Mon Sep 17 00:00:00 2001 From: Zachary Streeter <90640993+zstreet87@users.noreply.github.com> Date: Mon, 13 Feb 2023 23:04:12 -0600 Subject: [PATCH] Use miopenGetConvolutionSpatialDim if ROCm5.5 (#14483) MIOpen created a new API to get the spatial dimensions. --- onnxruntime/contrib_ops/rocm/fused_conv.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/onnxruntime/contrib_ops/rocm/fused_conv.cc b/onnxruntime/contrib_ops/rocm/fused_conv.cc index 1b98142f1f..4049d6dcb1 100644 --- a/onnxruntime/contrib_ops/rocm/fused_conv.cc +++ b/onnxruntime/contrib_ops/rocm/fused_conv.cc @@ -74,7 +74,10 @@ struct FNVHash { void HashConvolutionDescriptor(miopenConvolutionDescriptor_t cdesc) { int spatial_dim = 1; - // Current MIOpen doesn't provide API to probe the dimension of a +#if ROCM_VERSION >= 50500 + miopenGetConvolutionDescriptorSize(cdesc, &spatial_dim); +#else + // Previous versions of MIOpen doesn't provide API to probe the dimension of a // miopenConvolutionDescriptor_t, so we have to guess. // This algorithm is based on a specific behavior of miopenGetConvolutionNdDescriptor, // which fails when requestedSpatialDim > the convolution's spatial dimension @@ -113,6 +116,7 @@ struct FNVHash { "miopenGetConvolutionNdDescriptor is supposed to fail before spatial_dim gets to ", spatial_dim); } +#endif } private: uint32_t value_ = BASIS;