From 04475744466000519a92999982048856c2daf19d Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Tue, 8 Mar 2022 13:22:42 +0800 Subject: [PATCH] feat(opencl): add OpenCL cache compat level api GitOrigin-RevId: e7561e6879bcdbfee52d48387c8ec2a7f21a91d6 --- lite/include/lite/common_enum_c.h | 18 ++++++++++++++++++ lite/load_and_run/src/options/device_options.cpp | 2 +- lite/load_and_run/src/options/device_options.h | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lite/include/lite/common_enum_c.h b/lite/include/lite/common_enum_c.h index c37fc462..9bc9520d 100644 --- a/lite/include/lite/common_enum_c.h +++ b/lite/include/lite/common_enum_c.h @@ -105,5 +105,23 @@ typedef enum { LITE_ALGO_OPTIMIZED = 1 << 3, } LiteAlgoSelectStrategy; +/*! + * \brief enum for cache compat level, for example: adreno 630 cache may be apply to + * adreno 640, if you do not want search cache for adreno 640, just config SERIES_COMPAT + * or VENDOR_COMPAT, adreno 506 cache may be apply to adreno 630, if you do not want + * search cache for adreno 630, just config VENDOR_COMPAT + * WARN: this config just let program_cache_io try `use a old cache` for `device compile + * the cache` do not means MegEngine will insure the compile will be ok! it`s a device + * CL driver behavior, if compile failed!, MegEngine will try build from source, What`s + * more, even though compile from binary success, this cross-use-cache may affect + * performance, VENDOR_COMPAT will contain SERIES_COMPAT + */ +typedef enum { + LITE_NOT_COMPAT = 0, //! default not compat for series and vendor + LITE_SERIES_COMPAT = 1, //! for scene adreno 640 use adreno 630 cache + LITE_VENDOR_COMPAT = 2, //! for scene adreno 630 use adreno 506 cache + LITE_CACHE_COMPAT_LEVEL_CNT = 3 +} LiteOpenCLCacheCompatLevel; + #endif // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}} diff --git a/lite/load_and_run/src/options/device_options.cpp b/lite/load_and_run/src/options/device_options.cpp index 71107c88..49771baf 100644 --- a/lite/load_and_run/src/options/device_options.cpp +++ b/lite/load_and_run/src/options/device_options.cpp @@ -201,4 +201,4 @@ DEFINE_int32( multithread_default, -1, "set multithread device as running device with inplace mode"); DEFINE_string(multi_thread_core_ids, "", "set multithread core id"); -REGIST_OPTION_CREATOR(xpu_device, lar::XPUDeviceOption::create_option); \ No newline at end of file +REGIST_OPTION_CREATOR(xpu_device, lar::XPUDeviceOption::create_option); diff --git a/lite/load_and_run/src/options/device_options.h b/lite/load_and_run/src/options/device_options.h index fd487345..3f199f69 100644 --- a/lite/load_and_run/src/options/device_options.h +++ b/lite/load_and_run/src/options/device_options.h @@ -45,4 +45,4 @@ private: std::vector core_ids; std::string m_option_name; }; -} // namespace lar \ No newline at end of file +} // namespace lar