From c8ff8b63e836b890a63ef15e5fdfa45e2049ef3c Mon Sep 17 00:00:00 2001 From: linkk08 <124329195+linkk08@users.noreply.github.com> Date: Thu, 18 May 2023 20:30:06 +0800 Subject: [PATCH] [XPU] Add docs for gm_default_size and fix type (#1962) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add description of gm_default_size and change kunlunxin_gm_default_size‘s type to int64_t --- c_api/fastdeploy_capi/runtime/runtime_option.cc | 2 +- c_api/fastdeploy_capi/runtime/runtime_option.h | 1 + csharp/fastdeploy/runtime_option.cs | 1 + fastdeploy/runtime/backends/lite/option.h | 4 ++-- fastdeploy/runtime/runtime_option.h | 1 + python/fastdeploy/runtime.py | 1 + 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/c_api/fastdeploy_capi/runtime/runtime_option.cc b/c_api/fastdeploy_capi/runtime/runtime_option.cc index cba327869..4a809bbf5 100644 --- a/c_api/fastdeploy_capi/runtime/runtime_option.cc +++ b/c_api/fastdeploy_capi/runtime/runtime_option.cc @@ -108,7 +108,7 @@ void FD_C_RuntimeOptionWrapperUseKunlunXin( std::string(precision), bool(adaptive_seqlen), bool(enable_multi_stream), - gm_default_size); + int64_t(gm_default_size)); } void FD_C_RuntimeOptionWrapperUseSophgo( diff --git a/c_api/fastdeploy_capi/runtime/runtime_option.h b/c_api/fastdeploy_capi/runtime/runtime_option.h index 6f27e3686..15f02a8bf 100644 --- a/c_api/fastdeploy_capi/runtime/runtime_option.h +++ b/c_api/fastdeploy_capi/runtime/runtime_option.h @@ -126,6 +126,7 @@ FASTDEPLOY_CAPI_EXPORT extern void FD_C_RuntimeOptionWrapperUseAscend( /// \param[in] adaptive_seqlen Is the input of multi_encoder variable length /// \param[in] enable_multi_stream Whether to enable the multi stream of /// KunlunXin XPU. +/// \param[in] gm_default_size The default size of context global memory of KunlunXin XPU. /// FASTDEPLOY_CAPI_EXPORT extern void FD_C_RuntimeOptionWrapperUseKunlunXin( __fd_keep FD_C_RuntimeOptionWrapper* fd_c_runtime_option_wrapper, diff --git a/csharp/fastdeploy/runtime_option.cs b/csharp/fastdeploy/runtime_option.cs index 249fd30df..cd9170517 100644 --- a/csharp/fastdeploy/runtime_option.cs +++ b/csharp/fastdeploy/runtime_option.cs @@ -103,6 +103,7 @@ public class RuntimeOption { /// \param adaptive_seqlen Is the input of multi_encoder variable length /// \param enable_multi_stream Whether to enable the multi stream of /// KunlunXin XPU. + /// \param gm_default_size The default size of context global memory of KunlunXin XPU. /// public void UseKunlunXin(int kunlunxin_id = 0, int l3_workspace_size = 0xfffc00, diff --git a/fastdeploy/runtime/backends/lite/option.h b/fastdeploy/runtime/backends/lite/option.h index 9b90c861e..900a4c115 100755 --- a/fastdeploy/runtime/backends/lite/option.h +++ b/fastdeploy/runtime/backends/lite/option.h @@ -75,12 +75,12 @@ struct LiteBackendOption { std::string kunlunxin_autotune_file = ""; /// kunlunxin_precision std::string kunlunxin_precision = "int16"; - /// kunlunxin_gm_default_size - int kunlunxin_gm_default_size = 0; /// kunlunxin_adaptive_seqlen bool kunlunxin_adaptive_seqlen = false; /// kunlunxin_enable_multi_stream bool kunlunxin_enable_multi_stream = false; + /// kunlunxin_gm_default_size + int64_t kunlunxin_gm_default_size = 0; /// Optimized model dir for CxxConfig std::string optimized_model_dir = ""; diff --git a/fastdeploy/runtime/runtime_option.h b/fastdeploy/runtime/runtime_option.h index 8e99a88bf..38fda025b 100755 --- a/fastdeploy/runtime/runtime_option.h +++ b/fastdeploy/runtime/runtime_option.h @@ -106,6 +106,7 @@ struct FASTDEPLOY_DECL RuntimeOption { /// \param adaptive_seqlen Is the input of multi_encoder variable length /// \param enable_multi_stream Whether to enable the multi stream of /// KunlunXin XPU. + /// \param gm_default_size The default size of global memory of KunlunXin XPU. /// void UseKunlunXin(int kunlunxin_id = 0, int l3_workspace_size = 0xfffc00, bool locked = false, bool autotune = true, diff --git a/python/fastdeploy/runtime.py b/python/fastdeploy/runtime.py index fbd75e2a7..e2ecbb5cf 100755 --- a/python/fastdeploy/runtime.py +++ b/python/fastdeploy/runtime.py @@ -242,6 +242,7 @@ class RuntimeOption: :param precision: (str)Calculation accuracy of multi_encoder :param adaptive_seqlen: (bool)adaptive_seqlen Is the input of multi_encoder variable length :param enable_multi_stream: (bool)Whether to enable the multi stream of KunlunXin XPU. + :param gm_default_size The default size of context global memory of KunlunXin XPU. """ return self._option.use_kunlunxin(device_id, l3_workspace_size, locked, autotune, autotune_file, precision,