From 5969d576e551cf36f63e0497af7cb8b703541d02 Mon Sep 17 00:00:00 2001 From: Tianlei Wu Date: Mon, 13 Sep 2021 17:25:25 -0700 Subject: [PATCH] Revert "disable half2 kernel by dfault (#9034)" (#9044) This reverts commit 289999af351e3fea1568c2f8b97b9d3847f3ce82. --- onnxruntime/contrib_ops/cuda/bert/fast_gelu.cc | 2 +- onnxruntime/contrib_ops/cuda/bert/transformer_common.cc | 2 +- onnxruntime/contrib_ops/cuda/bert/transformer_common.h | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/onnxruntime/contrib_ops/cuda/bert/fast_gelu.cc b/onnxruntime/contrib_ops/cuda/bert/fast_gelu.cc index a547089232..864c614b99 100644 --- a/onnxruntime/contrib_ops/cuda/bert/fast_gelu.cc +++ b/onnxruntime/contrib_ops/cuda/bert/fast_gelu.cc @@ -34,7 +34,7 @@ using namespace ONNX_NAMESPACE; template FastGelu::FastGelu(const OpKernelInfo& op_kernel_info) : CudaKernel(op_kernel_info) { const TransformerOptions* options = TransformerOptions::GetInstance(); - use_half2_ = options->EnableHalf2(); + use_half2_ = !options->DisableHalf2(); } template diff --git a/onnxruntime/contrib_ops/cuda/bert/transformer_common.cc b/onnxruntime/contrib_ops/cuda/bert/transformer_common.cc index bac94463aa..847ad11cbf 100644 --- a/onnxruntime/contrib_ops/cuda/bert/transformer_common.cc +++ b/onnxruntime/contrib_ops/cuda/bert/transformer_common.cc @@ -25,7 +25,7 @@ const TransformerOptions* TransformerOptions::GetInstance() { if (value > 0) std::cout << "ORT_TRANSFORMER_OPTIONS: IsPrecisionMode=" << instance.IsPrecisionMode() << ",DisablePersistentSoftmax=" << instance.DisablePersistentSoftmax() - << ",EnableHalf2=" << instance.EnableHalf2() + << ",DisableHalf2=" << instance.DisableHalf2() << std::endl; } diff --git a/onnxruntime/contrib_ops/cuda/bert/transformer_common.h b/onnxruntime/contrib_ops/cuda/bert/transformer_common.h index 1ef75639c1..74c1b2522d 100644 --- a/onnxruntime/contrib_ops/cuda/bert/transformer_common.h +++ b/onnxruntime/contrib_ops/cuda/bert/transformer_common.h @@ -15,12 +15,12 @@ class TransformerOptions { bool DisablePersistentSoftmax() const { return disable_persistent_softmax_; } - bool EnableHalf2() const { return enable_half2_; } + bool DisableHalf2() const { return disable_half2_; } void Initialize(int value) { is_precision_mode_ = (value & 0x01) > 0; disable_persistent_softmax_ = (value & 0x02) > 0; - enable_half2_ = (value & 0x04) > 0; + disable_half2_ = (value & 0x04) > 0; initialized_ = true; } @@ -31,8 +31,8 @@ class TransformerOptions { // Disable persistent softmax. bool disable_persistent_softmax_{false}; - // Enable half2 kernel. - bool enable_half2_{false}; + // Disable half2 kernel. + bool disable_half2_{false}; bool initialized_{false};