set the environment variable "MS_GRAPH_KERNEL_FLAGS" to deprecated

This commit is contained in:
dayschan 2021-12-02 16:11:34 +08:00
parent fe9993a721
commit be11003ec7
3 changed files with 13 additions and 8 deletions

View File

@ -160,8 +160,7 @@ set_context(**kwargs)
- dump_as_text将详细信息转储为文本文件。默认值False。
有关更多选项可以参考实现代码。这些选项也可以通过环境变量MS_GRAPH_KERNEL_FLAGS设置而无需修改网络源代码。
例如导出MS_GRAPH_KERNEL_FLAGS="--opt_level=2 --dump_as_text"。
有关更多选项,可以参考实现代码。
enable_reduce_precision (bool)表示是否开启降低精度计算。默认值True。
设置为True时不支持用户指定的精度且精度将自动更改。
设置为False时如果未指定用例的精度则会报错并退出。
@ -217,4 +216,4 @@ set_context(**kwargs)
>>> context.set_context(grad_for_scalar=True)
>>> context.set_context(save_compile_cache=True)
>>> context.set_context(load_compile_cache=True)
>>> context.set_context(pynative_synchronize=True)
>>> context.set_context(pynative_synchronize=True)

View File

@ -150,11 +150,19 @@ class FlagRegister {
} // namespace
std::pair<std::string, bool> GraphKernelFlags::GetGraphKernelContext() {
// Use the environment variable in priority and not in lite
// This environment variable is deprecated.
auto env_flags = std::getenv("MS_GRAPH_KERNEL_FLAGS");
std::string flags = env_flags ? std::string(env_flags) : "";
bool use_env = (env_flags != nullptr);
std::string flags = use_env ? std::string(env_flags) : "";
bool enable_context{false};
#ifndef MSLITE_ENABLE_GRAPH_KERNEL
static bool print_warning = true;
if (use_env && print_warning) {
print_warning = false;
MS_LOG(WARNING) << "The environment variable \"MS_GRAPH_KERNEL_FLAGS\" is deprecated from version 1.6 "
<< "and will be removed in a future version, "
<< "use context \"graph_kernel_flags\" instead.";
}
auto context = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(context);
if (flags.empty()) {

View File

@ -741,9 +741,7 @@ def set_context(**kwargs):
- dump_as_text: dump detail info as text files. Default: false.
More options can refer to the implementation code. These options can also be set by environment
variable MS_GRAPH_KERNEL_FLAGS, without modifying network source code.
For example, export MS_GRAPH_KERNEL_FLAGS="--opt_level=2 --dump_as_text".
More options can refer to the implementation code.
enable_reduce_precision (bool): Whether to enable precision reduction.
If the operator does not support the user-specified precision, the precision will
be changed automatically. Default: True.