From b84c63db2a3e822b4aac58b73714f7b871e37e9c Mon Sep 17 00:00:00 2001 From: cloudhan Date: Thu, 6 Jul 2023 09:13:13 +0800 Subject: [PATCH] Fix ORT_RETURN condition mistake (#16520) In #16339, the `ORT_ENFORCE(cuda_device_arch_ >= 530` (throw) it changed to `ORT_RETURN_IF` (Status) but the condition is negated. This fixes the problem. --- .../cpu/transformers/beam_search_impl_gpt.h | 10 +++++----- .../contrib_ops/cpu/transformers/beam_search_impl_t5.h | 10 +++++----- .../cpu/transformers/beam_search_impl_whisper.h | 10 +++++----- .../cpu/transformers/greedy_search_impl_gpt.h | 10 +++++----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_gpt.h b/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_gpt.h index fd02825e75..97d62a81e7 100644 --- a/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_gpt.h +++ b/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_gpt.h @@ -55,11 +55,11 @@ class BeamSearchGpt : public BeamSearchBase { cuda_device_prop_ = cuda_device_prop; cuda_device_arch_ = cuda_device_arch; if (gpt_subgraph_.has_decoder_masked_attention_) { - ORT_RETURN_IF(cuda_device_arch_ >= 530, - "Decoder masked self attention can only be used on " - "GPU cards of compute capability 5.3 or higher. " - "This card has compute capability ", - cuda_device_arch_); + ORT_RETURN_IF_NOT(cuda_device_arch_ >= 530, + "Decoder masked self attention can only be used on " + "GPU cards of compute capability 5.3 or higher. " + "This card has compute capability ", + cuda_device_arch_); } return Status::OK(); } diff --git a/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_t5.h b/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_t5.h index ea15656e7e..72db3b1d0b 100644 --- a/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_t5.h +++ b/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_t5.h @@ -64,11 +64,11 @@ class BeamSearchT5 : public BeamSearchBase { cuda_device_prop_ = cuda_device_prop; cuda_device_arch_ = cuda_device_arch; if (decoder_subgraph_.has_decoder_masked_attention_) { - ORT_RETURN_IF(cuda_device_arch_ >= 530, - "Decoder masked multihead attention can only be used on " - "GPU cards of compute capability 5.3 or higher. " - "This card has compute capability ", - cuda_device_arch_); + ORT_RETURN_IF_NOT(cuda_device_arch_ >= 530, + "Decoder masked multihead attention can only be used on " + "GPU cards of compute capability 5.3 or higher. " + "This card has compute capability ", + cuda_device_arch_); } return Status::OK(); } diff --git a/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_whisper.h b/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_whisper.h index 9bfdc71802..e5bc01ef1f 100644 --- a/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_whisper.h +++ b/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_whisper.h @@ -62,11 +62,11 @@ class BeamSearchWhisper : public BeamSearchBase { cuda_device_prop_ = cuda_device_prop; cuda_device_arch_ = cuda_device_arch; if (decoder_subgraph_.has_decoder_masked_attention_) { - ORT_RETURN_IF(cuda_device_arch_ >= 530, - "Decoder masked multihead attention can only be used on " - "GPU cards of compute capability 5.3 or higher. " - "This card has compute capability ", - cuda_device_arch_); + ORT_RETURN_IF_NOT(cuda_device_arch_ >= 530, + "Decoder masked multihead attention can only be used on " + "GPU cards of compute capability 5.3 or higher. " + "This card has compute capability ", + cuda_device_arch_); } return Status::OK(); } diff --git a/onnxruntime/contrib_ops/cpu/transformers/greedy_search_impl_gpt.h b/onnxruntime/contrib_ops/cpu/transformers/greedy_search_impl_gpt.h index 0d10e0691d..f426b88ec6 100644 --- a/onnxruntime/contrib_ops/cpu/transformers/greedy_search_impl_gpt.h +++ b/onnxruntime/contrib_ops/cpu/transformers/greedy_search_impl_gpt.h @@ -69,11 +69,11 @@ class GreedySearchGpt : public GreedySearchBase { cuda_device_prop_ = cuda_device_prop; cuda_device_arch_ = cuda_device_arch; if (gpt_subgraph_.has_decoder_masked_attention_) { - ORT_RETURN_IF(cuda_device_arch_ >= 530, - "Decoder masked self attention can only be used on " - "GPU cards of compute capability 5.3 or higher. " - "This card has compute capability ", - cuda_device_arch_); + ORT_RETURN_IF_NOT(cuda_device_arch_ >= 530, + "Decoder masked self attention can only be used on " + "GPU cards of compute capability 5.3 or higher. " + "This card has compute capability ", + cuda_device_arch_); } return Status::OK(); }