From 0402f930f22e8c7a7e1b4f8f807aba157e2a84b5 Mon Sep 17 00:00:00 2001 From: Ye Wang <52801275+wangyems@users.noreply.github.com> Date: Thu, 23 Mar 2023 22:40:06 -0700 Subject: [PATCH] exclude decoder files in hipify.cmake (#15188) --- cmake/onnxruntime_rocm_hipify.cmake | 4 ++-- .../contrib_ops/cpu/transformers/beam_search_impl_gpt.h | 2 +- .../contrib_ops/cpu/transformers/greedy_search_impl_gpt.h | 2 +- .../cuda/decoder/decoder_masked_self_attention.cc | 5 +---- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/cmake/onnxruntime_rocm_hipify.cmake b/cmake/onnxruntime_rocm_hipify.cmake index 8a9c54359e..ebd6229204 100644 --- a/cmake/onnxruntime_rocm_hipify.cmake +++ b/cmake/onnxruntime_rocm_hipify.cmake @@ -90,8 +90,8 @@ set(contrib_ops_excluded_files "cuda_contrib_kernels.h" "inverse.cc" "fused_conv.cc" - "decoder/decoder_masked_multihead_attention.h" - "decoder/decoder_masked_multihead_attention.cc" + "decoder/decoder_masked_self_attention.h" + "decoder/decoder_masked_self_attention.cc" "decoder/fastertransformer_decoder_attention/decoder_masked_multihead_attention_impl.h" "decoder/fastertransformer_decoder_attention/decoder_masked_multihead_attention.h" "decoder/fastertransformer_decoder_attention/decoder_masked_multihead_attention_impl.cu" 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 b822938719..e90738a263 100644 --- a/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_gpt.h +++ b/onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_gpt.h @@ -51,7 +51,7 @@ class BeamSearchGpt : public BeamSearchBase { cuda_device_arch_(cuda_device_arch) { if (gpt_subgraph_.has_decoder_masked_self_attention_) { ORT_ENFORCE(cuda_device_arch_ >= 530, - "Decoder masked multihead attention can only be used on " + "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_); 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 4f5271ff46..ddbf86dd82 100644 --- a/onnxruntime/contrib_ops/cpu/transformers/greedy_search_impl_gpt.h +++ b/onnxruntime/contrib_ops/cpu/transformers/greedy_search_impl_gpt.h @@ -67,7 +67,7 @@ class GreedySearchGpt : public GreedySearchBase { cuda_device_arch_(cuda_device_arch) { if (gpt_subgraph_.has_decoder_masked_self_attention_) { ORT_ENFORCE(cuda_device_arch_ >= 530, - "Decoder masked multihead attention can only be used on " + "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_); diff --git a/onnxruntime/contrib_ops/cuda/decoder/decoder_masked_self_attention.cc b/onnxruntime/contrib_ops/cuda/decoder/decoder_masked_self_attention.cc index e56dfeeec3..bba7649703 100644 --- a/onnxruntime/contrib_ops/cuda/decoder/decoder_masked_self_attention.cc +++ b/onnxruntime/contrib_ops/cuda/decoder/decoder_masked_self_attention.cc @@ -73,10 +73,7 @@ Status DecoderMaskedSelfAttention::ComputeInternal(OpKernelContext* cont return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "Input sequence length should be 1 to use DecoderMaskedSelfAttention"); } - // TODO(hasesh): In future, we may support CrossAttention. Currently, this kernel only supports SelfAttention. - if (parameters.sequence_length != parameters.kv_sequence_length) { - return ORT_MAKE_STATUS(ONNXRUNTIME, NOT_IMPLEMENTED, "DecoderMaskedSelfAttention only supports self attention currently"); - } + ORT_ENFORCE(parameters.sequence_length == parameters.kv_sequence_length); // TODO(hasesh): If there is a need, we will support this later if (parameters.head_size != parameters.v_head_size) {