Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
724adf49
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2305
Star
20932
Fork
5423
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
724adf49
编写于
1年前
作者:
H
huangjiyi
提交者:
GitHub
1年前
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update cinn flags usage (#56896)
* update * update * fix empty arg * update test * update * fix bug * update
上级
52d29f0d
变更
70
隐藏空白更改
内联
并排
Showing
70 changed file
with
329 addition
and
256 deletion
+329
-256
CMakeLists.txt
CMakeLists.txt
+3
-0
cmake/cinn.cmake
cmake/cinn.cmake
+8
-10
paddle/cinn/CMakeLists.txt
paddle/cinn/CMakeLists.txt
+1
-1
paddle/cinn/auto_schedule/auto_tuner_test.cc
paddle/cinn/auto_schedule/auto_tuner_test.cc
+1
-1
paddle/cinn/auto_schedule/search_space/search_space.cc
paddle/cinn/auto_schedule/search_space/search_space.cc
+1
-1
paddle/cinn/auto_schedule/search_strategy/evolutionary_search.cc
...cinn/auto_schedule/search_strategy/evolutionary_search.cc
+1
-1
paddle/cinn/auto_schedule/task/task_optimizer.cc
paddle/cinn/auto_schedule/task/task_optimizer.cc
+1
-1
paddle/cinn/auto_schedule/task/task_registry.h
paddle/cinn/auto_schedule/task/task_registry.h
+1
-2
paddle/cinn/auto_schedule/task/task_registry_test.cc
paddle/cinn/auto_schedule/task/task_registry_test.cc
+1
-1
paddle/cinn/auto_schedule/tests/performance_comparison_test.cc
...e/cinn/auto_schedule/tests/performance_comparison_test.cc
+7
-7
paddle/cinn/backends/codegen_c.cc
paddle/cinn/backends/codegen_c.cc
+1
-1
paddle/cinn/backends/codegen_c.h
paddle/cinn/backends/codegen_c.h
+1
-2
paddle/cinn/backends/compiler.cc
paddle/cinn/backends/compiler.cc
+5
-5
paddle/cinn/backends/extern_func_emitter.cc
paddle/cinn/backends/extern_func_emitter.cc
+1
-1
paddle/cinn/backends/function_prototype.cc
paddle/cinn/backends/function_prototype.cc
+1
-1
paddle/cinn/backends/llvm/runtime_symbol_registry.cc
paddle/cinn/backends/llvm/runtime_symbol_registry.cc
+2
-2
paddle/cinn/backends/nvrtc/nvrtc_util.cc
paddle/cinn/backends/nvrtc/nvrtc_util.cc
+2
-2
paddle/cinn/common/context.cc
paddle/cinn/common/context.cc
+3
-3
paddle/cinn/common/context.h
paddle/cinn/common/context.h
+2
-2
paddle/cinn/frontend/computation_test.cc
paddle/cinn/frontend/computation_test.cc
+1
-1
paddle/cinn/frontend/interpreter.cc
paddle/cinn/frontend/interpreter.cc
+1
-1
paddle/cinn/frontend/interpreter_test.cc
paddle/cinn/frontend/interpreter_test.cc
+1
-1
paddle/cinn/frontend/optimize.cc
paddle/cinn/frontend/optimize.cc
+9
-9
paddle/cinn/frontend/paddle/model_parser_test.cc
paddle/cinn/frontend/paddle/model_parser_test.cc
+2
-2
paddle/cinn/frontend/paddle_model_convertor.cc
paddle/cinn/frontend/paddle_model_convertor.cc
+1
-1
paddle/cinn/frontend/paddle_model_convertor_test.cc
paddle/cinn/frontend/paddle_model_convertor_test.cc
+1
-1
paddle/cinn/frontend/paddle_model_to_program.cc
paddle/cinn/frontend/paddle_model_to_program.cc
+1
-1
paddle/cinn/frontend/pass/pass_test_helper.h
paddle/cinn/frontend/pass/pass_test_helper.h
+2
-2
paddle/cinn/frontend/syntax_test.cc
paddle/cinn/frontend/syntax_test.cc
+1
-1
paddle/cinn/gtest_main.cc
paddle/cinn/gtest_main.cc
+2
-2
paddle/cinn/hlir/framework/accuracy_checker.cc
paddle/cinn/hlir/framework/accuracy_checker.cc
+1
-1
paddle/cinn/hlir/framework/accuracy_checker_test.cc
paddle/cinn/hlir/framework/accuracy_checker_test.cc
+1
-1
paddle/cinn/hlir/framework/graph.cc
paddle/cinn/hlir/framework/graph.cc
+1
-1
paddle/cinn/hlir/framework/graph_test.cc
paddle/cinn/hlir/framework/graph_test.cc
+1
-1
paddle/cinn/hlir/framework/instruction.cc
paddle/cinn/hlir/framework/instruction.cc
+2
-2
paddle/cinn/hlir/framework/new_ir/op_lowering_impl.cc
paddle/cinn/hlir/framework/new_ir/op_lowering_impl.cc
+1
-1
paddle/cinn/hlir/framework/op_lowering_impl.cc
paddle/cinn/hlir/framework/op_lowering_impl.cc
+1
-1
paddle/cinn/hlir/framework/parallel_compiler.cc
paddle/cinn/hlir/framework/parallel_compiler.cc
+1
-1
paddle/cinn/hlir/framework/visualize_helper.cc
paddle/cinn/hlir/framework/visualize_helper.cc
+2
-2
paddle/cinn/hlir/op/contrib/bitcast_convert.cc
paddle/cinn/hlir/op/contrib/bitcast_convert.cc
+0
-2
paddle/cinn/hlir/op/contrib/cholesky.cc
paddle/cinn/hlir/op/contrib/cholesky.cc
+0
-2
paddle/cinn/hlir/op/contrib/gather_nd.cc
paddle/cinn/hlir/op/contrib/gather_nd.cc
+0
-2
paddle/cinn/hlir/op/contrib/gaussian_random.cc
paddle/cinn/hlir/op/contrib/gaussian_random.cc
+0
-2
paddle/cinn/hlir/op/contrib/logical_right_shift.cc
paddle/cinn/hlir/op/contrib/logical_right_shift.cc
+1
-1
paddle/cinn/hlir/op/contrib/lookup_table.cc
paddle/cinn/hlir/op/contrib/lookup_table.cc
+1
-1
paddle/cinn/hlir/op/contrib/one_hot.cc
paddle/cinn/hlir/op/contrib/one_hot.cc
+0
-2
paddle/cinn/hlir/op/contrib/randint.cc
paddle/cinn/hlir/op/contrib/randint.cc
+0
-2
paddle/cinn/hlir/op/contrib/reciprocal.cc
paddle/cinn/hlir/op/contrib/reciprocal.cc
+1
-1
paddle/cinn/hlir/op/contrib/repeat.cc
paddle/cinn/hlir/op/contrib/repeat.cc
+0
-2
paddle/cinn/hlir/op/contrib/resize.cc
paddle/cinn/hlir/op/contrib/resize.cc
+0
-2
paddle/cinn/hlir/op/contrib/sort.cc
paddle/cinn/hlir/op/contrib/sort.cc
+0
-2
paddle/cinn/hlir/op/contrib/uniform_random.cc
paddle/cinn/hlir/op/contrib/uniform_random.cc
+0
-2
paddle/cinn/hlir/pass/alterlayout_test.cc
paddle/cinn/hlir/pass/alterlayout_test.cc
+1
-1
paddle/cinn/hlir/pass/common_subexpression_elimination_test.cc
...e/cinn/hlir/pass/common_subexpression_elimination_test.cc
+1
-1
paddle/cinn/hlir/pass/const_propagate_test.cc
paddle/cinn/hlir/pass/const_propagate_test.cc
+1
-1
paddle/cinn/hlir/pass/custom_call_pass.cc
paddle/cinn/hlir/pass/custom_call_pass.cc
+1
-1
paddle/cinn/hlir/pass/fusion_merge_pass.cc
paddle/cinn/hlir/pass/fusion_merge_pass.cc
+1
-1
paddle/cinn/hlir/pass/general_fusion_merge_pass.cc
paddle/cinn/hlir/pass/general_fusion_merge_pass.cc
+1
-1
paddle/cinn/hlir/pass/opfusion_test.cc
paddle/cinn/hlir/pass/opfusion_test.cc
+1
-1
paddle/cinn/hlir/pass/test_primitive_ops.cc
paddle/cinn/hlir/pass/test_primitive_ops.cc
+1
-1
paddle/cinn/hlir/pe/schedule.cc
paddle/cinn/hlir/pe/schedule.cc
+1
-1
paddle/cinn/ir/schedule/ir_schedule.cc
paddle/cinn/ir/schedule/ir_schedule.cc
+1
-1
paddle/cinn/runtime/custom_function.cc
paddle/cinn/runtime/custom_function.cc
+1
-1
paddle/cinn/runtime/flags.cc
paddle/cinn/runtime/flags.cc
+147
-135
paddle/cinn/utils/profiler.cc
paddle/cinn/utils/profiler.cc
+2
-2
paddle/utils/CMakeLists.txt
paddle/utils/CMakeLists.txt
+11
-8
paddle/utils/flags.h
paddle/utils/flags.h
+26
-0
paddle/utils/flags_native.cc
paddle/utils/flags_native.cc
+41
-0
paddle/utils/flags_native.h
paddle/utils/flags_native.h
+6
-0
paddle/utils/flags_native_test.cc
paddle/utils/flags_native_test.cc
+6
-0
未找到文件。
CMakeLists.txt
浏览文件 @
724adf49
...
...
@@ -610,6 +610,9 @@ if(WITH_CINN)
add_subdirectory
(
python
)
endif
()
add_subdirectory
(
test
)
if
(
NOT WITH_GFLAGS
)
add_subdirectory
(
paddle/utils
)
endif
()
return
()
endif
()
endif
()
...
...
This diff is collapsed.
Click to expand it.
cmake/cinn.cmake
浏览文件 @
724adf49
...
...
@@ -114,10 +114,6 @@ include(cmake/cinn/core.cmake)
include
(
cmake/cinn/nvrtc.cmake
)
include
(
cmake/cinn/nvtx.cmake
)
if
(
CINN_ONLY
)
link_libraries
(
gflags
)
endif
()
set
(
LINK_FLAGS
"-Wl,--version-script
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/cinn/export.map"
CACHE INTERNAL
""
)
...
...
@@ -183,9 +179,9 @@ if(WITH_MKL)
endif
()
endif
()
if
(
NOT WITH_GFLAGS
)
target_link_libraries
(
cinnapi
gflags
)
add_dependencies
(
cinnapi
gflags
)
if
(
CINN_ONLY
)
target_link_libraries
(
cinnapi
${
flags_dep
}
)
add_dependencies
(
cinnapi
${
flags_dep
}
)
endif
()
if
(
WITH_GPU
)
...
...
@@ -242,9 +238,9 @@ function(gen_cinncore LINKTYPE)
endif
()
endif
()
if
(
NOT WITH_GFLAGS
)
target_link_libraries
(
${
CINNCORE_TARGET
}
gflags
)
add_dependencies
(
${
CINNCORE_TARGET
}
gflags
)
if
(
CINN_ONLY
)
target_link_libraries
(
${
CINNCORE_TARGET
}
${
flags_dep
}
)
add_dependencies
(
${
CINNCORE_TARGET
}
${
flags_dep
}
)
endif
()
if
(
WITH_GPU
)
...
...
@@ -272,6 +268,8 @@ set(PUBLISH_LIBS ON)
if
(
PUBLISH_LIBS
)
set
(
core_includes
"
${
core_includes
}
;paddle/cinn/runtime/cuda/cinn_cuda_runtime_source.cuh"
)
set
(
core_includes
"
${
core_includes
}
;paddle/utils/flags.h;paddle/utils/flags_native.h"
)
foreach
(
header
${
core_includes
}
)
get_filename_component
(
prefix
${
header
}
DIRECTORY
)
file
(
COPY
${
header
}
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/CMakeLists.txt
浏览文件 @
724adf49
if
(
WITH_TESTING
)
cinn_cc_library
(
cinn_gtest_main SRCS gtest_main.cc DEPS gtest
gflags
)
cinn_cc_library
(
cinn_gtest_main SRCS gtest_main.cc DEPS gtest
${
flags_dep
}
)
endif
()
add_subdirectory
(
api
)
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/auto_schedule/auto_tuner_test.cc
浏览文件 @
724adf49
...
...
@@ -32,7 +32,7 @@
#include "paddle/cinn/ir/ir_base.h"
#include "paddle/cinn/runtime/flags.h"
DECLARE_bool
(
auto_schedule_use_cost_model
);
PD_
DECLARE_bool
(
auto_schedule_use_cost_model
);
namespace
cinn
{
namespace
auto_schedule
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/auto_schedule/search_space/search_space.cc
浏览文件 @
724adf49
...
...
@@ -34,7 +34,7 @@
#include "paddle/cinn/ir/utils/ir_copy.h"
#include "paddle/cinn/runtime/flags.h"
DECLARE_bool
(
auto_schedule_use_cost_model
);
PD_
DECLARE_bool
(
auto_schedule_use_cost_model
);
namespace
cinn
{
namespace
auto_schedule
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/auto_schedule/search_strategy/evolutionary_search.cc
浏览文件 @
724adf49
...
...
@@ -36,7 +36,7 @@
#include "paddle/cinn/utils/sized_multi_set.h"
#include "paddle/cinn/utils/string.h"
DECLARE_bool
(
auto_schedule_use_cost_model
);
PD_
DECLARE_bool
(
auto_schedule_use_cost_model
);
namespace
cinn
{
namespace
auto_schedule
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/auto_schedule/task/task_optimizer.cc
浏览文件 @
724adf49
...
...
@@ -40,7 +40,7 @@
#include "paddle/cinn/backends/cuda_util.h"
#endif
DECLARE_bool
(
auto_schedule_use_cost_model
);
PD_
DECLARE_bool
(
auto_schedule_use_cost_model
);
namespace
cinn
{
namespace
auto_schedule
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/auto_schedule/task/task_registry.h
浏览文件 @
724adf49
...
...
@@ -14,14 +14,13 @@
#pragma once
#include <gflags/gflags.h>
#include <mutex>
#include <string>
#include "paddle/cinn/ir/schedule/ir_schedule.h"
#include "paddle/cinn/ir/utils/ir_copy.h"
#include "paddle/cinn/utils/registry.h"
#include "paddle/utils/flags.h"
namespace
cinn
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/auto_schedule/task/task_registry_test.cc
浏览文件 @
724adf49
...
...
@@ -28,7 +28,7 @@
#include "paddle/cinn/utils/string.h"
#include "paddle/cinn/utils/type_defs.h"
DECLARE_bool
(
auto_schedule_use_cost_model
);
PD_
DECLARE_bool
(
auto_schedule_use_cost_model
);
namespace
cinn
{
namespace
auto_schedule
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/auto_schedule/tests/performance_comparison_test.cc
浏览文件 @
724adf49
...
...
@@ -44,9 +44,9 @@
* parameters for more detail.
*/
DEFINE_string
(
resnet50_model_dir
,
"./ResNet50"
,
"the path to paddle model resnet50."
);
PD_
DEFINE_string
(
resnet50_model_dir
,
"./ResNet50"
,
"the path to paddle model resnet50."
);
// Flags that control which schedule tests will be run.
// Bit with index 0 controls no schedule test, means options = 1 = "001" will
// run no schedule test. Bit with index 1 controls manual schedule test, means
...
...
@@ -54,10 +54,10 @@ DEFINE_string(resnet50_model_dir,
// auto schedule test, means options = 4 = "100" will run auto schedule test.
// The default value is -1, which means that this flag is disabled to set the
// options
DEFINE_int32
(
evaluate_knobs
,
-
1
,
"the options to control which schedule tests will be run."
);
DECLARE_double
(
cinn_infer_model_version
);
PD_
DEFINE_int32
(
evaluate_knobs
,
-
1
,
"the options to control which schedule tests will be run."
);
PD_
DECLARE_double
(
cinn_infer_model_version
);
namespace
cinn
{
namespace
auto_schedule
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/backends/codegen_c.cc
浏览文件 @
724adf49
...
...
@@ -29,7 +29,7 @@
#include "paddle/cinn/utils/string.h"
//! Root of the builtin code.
DECLARE_string
(
cinn_x86_builtin_code_root
);
PD_
DECLARE_string
(
cinn_x86_builtin_code_root
);
namespace
cinn
{
namespace
backends
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/backends/codegen_c.h
浏览文件 @
724adf49
...
...
@@ -14,8 +14,6 @@
#pragma once
#include <gflags/gflags.h>
#include <string>
#include <vector>
...
...
@@ -27,6 +25,7 @@
#include "paddle/cinn/ir/utils/ir_printer.h"
#include "paddle/cinn/lang/packed_func.h"
#include "paddle/cinn/runtime/cinn_runtime.h"
#include "paddle/utils/flags.h"
namespace
cinn
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/backends/compiler.cc
浏览文件 @
724adf49
...
...
@@ -30,11 +30,11 @@
#include "paddle/cinn/runtime/flags.h"
#endif
DECLARE_string
(
cinn_source_code_save_path
);
DECLARE_string
(
cinn_dump_group_lowered_func
);
DECLARE_string
(
cinn_dump_group_source_code
);
DECLARE_string
(
cinn_dump_group_ptx
);
DECLARE_string
(
cinn_dump_group_instruction
);
PD_
DECLARE_string
(
cinn_source_code_save_path
);
PD_
DECLARE_string
(
cinn_dump_group_lowered_func
);
PD_
DECLARE_string
(
cinn_dump_group_source_code
);
PD_
DECLARE_string
(
cinn_dump_group_ptx
);
PD_
DECLARE_string
(
cinn_dump_group_instruction
);
namespace
cinn
{
namespace
backends
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/backends/extern_func_emitter.cc
浏览文件 @
724adf49
...
...
@@ -27,7 +27,7 @@
#include "paddle/cinn/runtime/flags.h"
#include "paddle/cinn/utils/string.h"
DECLARE_bool
(
verbose_function_register
);
PD_
DECLARE_bool
(
verbose_function_register
);
namespace
cinn
{
namespace
backends
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/backends/function_prototype.cc
浏览文件 @
724adf49
...
...
@@ -21,7 +21,7 @@
#include "paddle/cinn/ir/tensor.h"
#include "paddle/cinn/runtime/flags.h"
DECLARE_bool
(
verbose_function_register
);
PD_
DECLARE_bool
(
verbose_function_register
);
namespace
cinn
{
namespace
backends
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/backends/llvm/runtime_symbol_registry.cc
浏览文件 @
724adf49
...
...
@@ -19,10 +19,10 @@
#include <iostream>
#include "gflags/gflags_declare.h"
#include "paddle/cinn/runtime/flags.h"
#include "paddle/utils/flags.h"
DECLARE_bool
(
verbose_function_register
);
PD_
DECLARE_bool
(
verbose_function_register
);
namespace
cinn
{
namespace
backends
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/backends/nvrtc/nvrtc_util.cc
浏览文件 @
724adf49
...
...
@@ -30,8 +30,8 @@
#include "paddle/cinn/runtime/flags.h"
#include "paddle/cinn/utils/string.h"
DECLARE_string
(
cinn_nvcc_cmd_path
);
DECLARE_bool
(
nvrtc_compile_to_cubin
);
PD_
DECLARE_string
(
cinn_nvcc_cmd_path
);
PD_
DECLARE_bool
(
nvrtc_compile_to_cubin
);
namespace
cinn
{
namespace
backends
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/common/context.cc
浏览文件 @
724adf49
...
...
@@ -78,7 +78,7 @@ std::string NameGenerator::New(const std::string& name_hint) {
}
// namespace common
DEFINE_bool
(
cinn_runtime_display_debug_info
,
false
,
"Whether to display debug information in runtime"
);
PD_
DEFINE_bool
(
cinn_runtime_display_debug_info
,
false
,
"Whether to display debug information in runtime"
);
}
// namespace cinn
This diff is collapsed.
Click to expand it.
paddle/cinn/common/context.h
浏览文件 @
724adf49
...
...
@@ -14,7 +14,6 @@
#pragma once
#include <absl/types/any.h>
#include <gflags/gflags.h>
#include <isl/cpp.h>
#include <mutex>
...
...
@@ -25,10 +24,11 @@
#include "paddle/cinn/common/debug_manager.h"
#include "paddle/cinn/common/info_registry.h"
#include "paddle/cinn/common/target.h"
#include "paddle/utils/flags.h"
namespace
cinn
{
DECLARE_bool
(
cinn_runtime_display_debug_info
);
PD_
DECLARE_bool
(
cinn_runtime_display_debug_info
);
namespace
ir
{
class
Expr
;
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/frontend/computation_test.cc
浏览文件 @
724adf49
...
...
@@ -23,7 +23,7 @@
#include "paddle/cinn/frontend/pass/use_program_pass.h"
#include "paddle/cinn/frontend/program_pass.h"
DEFINE_string
(
model_dir
,
""
,
""
);
PD_
DEFINE_string
(
model_dir
,
""
,
""
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/frontend/interpreter.cc
浏览文件 @
724adf49
...
...
@@ -25,7 +25,7 @@
#include "paddle/cinn/hlir/pass/use_pass.h"
#include "paddle/cinn/runtime/flags.h"
DECLARE_bool
(
enable_auto_tuner
);
PD_
DECLARE_bool
(
enable_auto_tuner
);
namespace
cinn
::
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/frontend/interpreter_test.cc
浏览文件 @
724adf49
...
...
@@ -18,7 +18,7 @@
#include "paddle/cinn/runtime/use_extern_funcs.h"
DEFINE_string
(
model_dir
,
""
,
""
);
PD_
DEFINE_string
(
model_dir
,
""
,
""
);
namespace
cinn
::
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/frontend/optimize.cc
浏览文件 @
724adf49
...
...
@@ -29,15 +29,15 @@
#include "paddle/cinn/hlir/pass/use_pass.h"
#include "paddle/cinn/runtime/flags.h"
DECLARE_bool
(
cinn_use_fill_constant_folding
);
DECLARE_bool
(
cinn_use_op_fusion
);
DECLARE_bool
(
cinn_use_common_subexpression_elimination
);
DECLARE_string
(
cinn_check_fusion_accuracy_pass
);
DECLARE_bool
(
cinn_use_custom_call
);
DECLARE_bool
(
use_reduce_split_pass
);
DECLARE_bool
(
cinn_use_dense_merge_pass
);
DECLARE_string
(
cinn_custom_call_deny_ops
);
DECLARE_bool
(
general_fusion_merge_pass
);
PD_
DECLARE_bool
(
cinn_use_fill_constant_folding
);
PD_
DECLARE_bool
(
cinn_use_op_fusion
);
PD_
DECLARE_bool
(
cinn_use_common_subexpression_elimination
);
PD_
DECLARE_string
(
cinn_check_fusion_accuracy_pass
);
PD_
DECLARE_bool
(
cinn_use_custom_call
);
PD_
DECLARE_bool
(
use_reduce_split_pass
);
PD_
DECLARE_bool
(
cinn_use_dense_merge_pass
);
PD_
DECLARE_string
(
cinn_custom_call_deny_ops
);
PD_
DECLARE_bool
(
general_fusion_merge_pass
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/frontend/paddle/model_parser_test.cc
浏览文件 @
724adf49
...
...
@@ -14,10 +14,10 @@
#include "paddle/cinn/frontend/paddle/model_parser.h"
#include <gflags/gflags.h>
#include <gtest/gtest.h>
#include "paddle/utils/flags.h"
DEFINE_string
(
model_dir
,
"<NOTEXIST>"
,
"model directory path"
);
PD_
DEFINE_string
(
model_dir
,
"<NOTEXIST>"
,
"model directory path"
);
namespace
cinn
::
frontend
::
paddle
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/frontend/paddle_model_convertor.cc
浏览文件 @
724adf49
...
...
@@ -27,7 +27,7 @@
#include "paddle/cinn/frontend/var_type_utils.h"
#include "paddle/cinn/hlir/op/use_ops.h"
DECLARE_double
(
cinn_infer_model_version
);
PD_
DECLARE_double
(
cinn_infer_model_version
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/frontend/paddle_model_convertor_test.cc
浏览文件 @
724adf49
...
...
@@ -20,7 +20,7 @@
#include "paddle/cinn/frontend/decomposer/test_helper.h"
#include "paddle/cinn/runtime/use_extern_funcs.h"
DEFINE_string
(
model_dir
,
""
,
""
);
PD_
DEFINE_string
(
model_dir
,
""
,
""
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/frontend/paddle_model_to_program.cc
浏览文件 @
724adf49
...
...
@@ -21,7 +21,7 @@
#include "paddle/cinn/frontend/paddle/pb/program_desc.h"
#include "paddle/cinn/hlir/framework/node.h"
DECLARE_double
(
cinn_infer_model_version
);
PD_
DECLARE_double
(
cinn_infer_model_version
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/frontend/pass/pass_test_helper.h
浏览文件 @
724adf49
...
...
@@ -14,7 +14,6 @@
#pragma once
#include <gflags/gflags.h>
#include <gtest/gtest.h>
#include <algorithm>
...
...
@@ -42,8 +41,9 @@
#include "paddle/cinn/hlir/op/use_ops.h"
#include "paddle/cinn/hlir/pass/use_pass.h"
#include "paddle/cinn/utils/data_util.h"
#include "paddle/utils/flags.h"
DECLARE_bool
(
cinn_use_op_fusion
);
PD_
DECLARE_bool
(
cinn_use_op_fusion
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/frontend/syntax_test.cc
浏览文件 @
724adf49
...
...
@@ -30,7 +30,7 @@
#include "paddle/cinn/hlir/pass/use_pass.h"
#include "paddle/cinn/utils/data_util.h"
DEFINE_string
(
model_dir
,
""
,
""
);
PD_
DEFINE_string
(
model_dir
,
""
,
""
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/gtest_main.cc
浏览文件 @
724adf49
...
...
@@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <gflags/gflags.h>
#include <gtest/gtest.h>
#include "paddle/utils/flags.h"
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
GFLAGS_NAMESPACE
::
ParseCommandLineFlags
(
&
argc
,
&
argv
,
false
);
paddle
::
flags
::
ParseCommandLineFlags
(
&
argc
,
&
argv
);
return
RUN_ALL_TESTS
();
}
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/framework/accuracy_checker.cc
浏览文件 @
724adf49
...
...
@@ -21,7 +21,7 @@
#include <cuda_runtime.h>
#endif
DECLARE_int64
(
cinn_self_check_accuracy_num
);
PD_
DECLARE_int64
(
cinn_self_check_accuracy_num
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/framework/accuracy_checker_test.cc
浏览文件 @
724adf49
...
...
@@ -25,7 +25,7 @@
#include "paddle/cinn/hlir/framework/instruction.h"
#include "paddle/cinn/hlir/framework/op_strategy.h"
DECLARE_string
(
cinn_self_check_accuracy
);
PD_
DECLARE_string
(
cinn_self_check_accuracy
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/framework/graph.cc
浏览文件 @
724adf49
...
...
@@ -21,7 +21,7 @@
#include "paddle/cinn/runtime/flags.h"
#include "paddle/cinn/utils/string.h"
DECLARE_string
(
cinn_fusion_groups_graphviz_dir
);
PD_
DECLARE_string
(
cinn_fusion_groups_graphviz_dir
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/framework/graph_test.cc
浏览文件 @
724adf49
...
...
@@ -20,7 +20,7 @@
#include "paddle/cinn/hlir/framework/pass.h"
#include "paddle/cinn/hlir/pass/use_pass.h"
DECLARE_string
(
cinn_fusion_groups_graphviz_dir
);
PD_
DECLARE_string
(
cinn_fusion_groups_graphviz_dir
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/framework/instruction.cc
浏览文件 @
724adf49
...
...
@@ -22,8 +22,8 @@
#include "paddle/cinn/runtime/flags.h"
#include "paddle/cinn/utils/profiler.h"
DECLARE_bool
(
cinn_sync_run
);
DECLARE_string
(
cinn_self_check_accuracy
);
PD_
DECLARE_bool
(
cinn_sync_run
);
PD_
DECLARE_string
(
cinn_self_check_accuracy
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/framework/new_ir/op_lowering_impl.cc
浏览文件 @
724adf49
...
...
@@ -26,7 +26,7 @@
#include "paddle/fluid/ir/dialect/paddle_dialect/ir/pd_type.h"
#include "paddle/phi/core/ddim.h"
DECLARE_bool
(
cinn_use_cuda_vectorize
);
PD_
DECLARE_bool
(
cinn_use_cuda_vectorize
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/framework/op_lowering_impl.cc
浏览文件 @
724adf49
...
...
@@ -19,7 +19,7 @@
#include "paddle/cinn/ir/schedule/ir_schedule.h"
#include "paddle/cinn/optim/transform_gpu_forloop.h"
DECLARE_bool
(
cinn_use_cuda_vectorize
);
PD_
DECLARE_bool
(
cinn_use_cuda_vectorize
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/framework/parallel_compiler.cc
浏览文件 @
724adf49
...
...
@@ -32,7 +32,7 @@
#include "paddle/cinn/ir/module.h"
#include "paddle/cinn/runtime/flags.h"
DECLARE_int32
(
cinn_parallel_compile_thread
);
PD_
DECLARE_int32
(
cinn_parallel_compile_thread
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/framework/visualize_helper.cc
浏览文件 @
724adf49
...
...
@@ -30,8 +30,8 @@
#include "paddle/cinn/utils/dot_lang.h"
#include "paddle/cinn/utils/string.h"
DECLARE_string
(
cinn_pass_visualize_dir
);
DECLARE_string
(
cinn_check_fusion_accuracy_pass
);
PD_
DECLARE_string
(
cinn_pass_visualize_dir
);
PD_
DECLARE_string
(
cinn_check_fusion_accuracy_pass
);
namespace
cinn
{
namespace
hlir
{
namespace
framework
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/bitcast_convert.cc
浏览文件 @
724adf49
...
...
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <utility>
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/cholesky.cc
浏览文件 @
724adf49
...
...
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <utility>
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/gather_nd.cc
浏览文件 @
724adf49
...
...
@@ -14,8 +14,6 @@
#include "paddle/cinn/hlir/op/contrib/gather_nd.h"
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <utility>
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/gaussian_random.cc
浏览文件 @
724adf49
...
...
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <utility>
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/logical_right_shift.cc
浏览文件 @
724adf49
...
...
@@ -17,7 +17,6 @@
#include <utility>
#include <vector>
#include "gflags/gflags.h"
#include "paddle/cinn/common/cas.h"
#include "paddle/cinn/common/common.h"
#include "paddle/cinn/common/context.h"
...
...
@@ -37,6 +36,7 @@
#include "paddle/cinn/ir/tensor.h"
#include "paddle/cinn/lang/builtin.h"
#include "paddle/cinn/lang/compute.h"
#include "paddle/utils/flags.h"
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/lookup_table.cc
浏览文件 @
724adf49
...
...
@@ -19,7 +19,6 @@
#include <utility>
#include <vector>
#include "gflags/gflags.h"
#include "paddle/cinn/common/cas.h"
#include "paddle/cinn/common/common.h"
#include "paddle/cinn/common/context.h"
...
...
@@ -38,6 +37,7 @@
#include "paddle/cinn/ir/tensor.h"
#include "paddle/cinn/lang/builtin.h"
#include "paddle/cinn/lang/compute.h"
#include "paddle/utils/flags.h"
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/one_hot.cc
浏览文件 @
724adf49
...
...
@@ -14,8 +14,6 @@
#include "paddle/cinn/hlir/op/contrib/one_hot.h"
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <utility>
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/randint.cc
浏览文件 @
724adf49
...
...
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <utility>
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/reciprocal.cc
浏览文件 @
724adf49
...
...
@@ -17,7 +17,6 @@
#include <utility>
#include <vector>
#include "gflags/gflags.h"
#include "paddle/cinn/common/cas.h"
#include "paddle/cinn/common/common.h"
#include "paddle/cinn/common/context.h"
...
...
@@ -37,6 +36,7 @@
#include "paddle/cinn/ir/tensor.h"
#include "paddle/cinn/lang/builtin.h"
#include "paddle/cinn/lang/compute.h"
#include "paddle/utils/flags.h"
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/repeat.cc
浏览文件 @
724adf49
...
...
@@ -14,8 +14,6 @@
#include "paddle/cinn/hlir/op/contrib/repeat.h"
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <utility>
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/resize.cc
浏览文件 @
724adf49
...
...
@@ -14,8 +14,6 @@
#include "paddle/cinn/hlir/op/contrib/resize.h"
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <utility>
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/sort.cc
浏览文件 @
724adf49
...
...
@@ -14,8 +14,6 @@
#include "paddle/cinn/hlir/op/contrib/sort.h"
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <utility>
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/op/contrib/uniform_random.cc
浏览文件 @
724adf49
...
...
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <utility>
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/pass/alterlayout_test.cc
浏览文件 @
724adf49
...
...
@@ -25,7 +25,7 @@
#include "paddle/cinn/hlir/pass/use_pass.h"
#include "paddle/cinn/utils/data_util.h"
DEFINE_string
(
model_dir
,
""
,
""
);
PD_
DEFINE_string
(
model_dir
,
""
,
""
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/pass/common_subexpression_elimination_test.cc
浏览文件 @
724adf49
...
...
@@ -37,7 +37,7 @@
#include "paddle/cinn/hlir/framework/pass.h"
#include "paddle/cinn/utils/data_util.h"
DEFINE_string
(
model_dir
,
""
,
""
);
PD_
DEFINE_string
(
model_dir
,
""
,
""
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/pass/const_propagate_test.cc
浏览文件 @
724adf49
...
...
@@ -25,7 +25,7 @@
#include "paddle/cinn/hlir/pass/use_pass.h"
#include "paddle/cinn/utils/data_util.h"
DEFINE_string
(
model_dir
,
""
,
""
);
PD_
DEFINE_string
(
model_dir
,
""
,
""
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/pass/custom_call_pass.cc
浏览文件 @
724adf49
...
...
@@ -17,7 +17,7 @@
#include "paddle/cinn/hlir/op/external_api_registry.h"
#include "paddle/cinn/utils/string.h"
DECLARE_string
(
cinn_custom_call_deny_ops
);
PD_
DECLARE_string
(
cinn_custom_call_deny_ops
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/pass/fusion_merge_pass.cc
浏览文件 @
724adf49
...
...
@@ -14,7 +14,7 @@
#include "paddle/cinn/hlir/pass/fusion_merge_pass_util.h"
DECLARE_bool
(
enhance_vertical_fusion_with_recompute
);
PD_
DECLARE_bool
(
enhance_vertical_fusion_with_recompute
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/pass/general_fusion_merge_pass.cc
浏览文件 @
724adf49
...
...
@@ -26,7 +26,7 @@
#include "paddle/cinn/hlir/pass/general_fusion_merge_pass/lightware_fuse_pass_ctx.h"
#include "paddle/cinn/hlir/pass/general_fusion_merge_pass_utils.h"
DECLARE_bool
(
enhance_vertical_fusion_with_recompute
);
PD_
DECLARE_bool
(
enhance_vertical_fusion_with_recompute
);
namespace
cinn
{
namespace
hlir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/pass/opfusion_test.cc
浏览文件 @
724adf49
...
...
@@ -25,7 +25,7 @@
#include "paddle/cinn/hlir/pass/use_pass.h"
#include "paddle/cinn/utils/data_util.h"
DEFINE_string
(
model_dir
,
""
,
""
);
PD_
DEFINE_string
(
model_dir
,
""
,
""
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/pass/test_primitive_ops.cc
浏览文件 @
724adf49
...
...
@@ -26,7 +26,7 @@
#include "paddle/cinn/hlir/pass/use_pass.h"
#include "paddle/cinn/utils/data_util.h"
DEFINE_string
(
model_dir
,
""
,
""
);
PD_
DEFINE_string
(
model_dir
,
""
,
""
);
namespace
cinn
{
namespace
frontend
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/hlir/pe/schedule.cc
浏览文件 @
724adf49
...
...
@@ -31,7 +31,7 @@
#include "paddle/cinn/poly/isl_utils.h"
#include "paddle/cinn/utils/string.h"
DECLARE_bool
(
cinn_use_cuda_vectorize
);
PD_
DECLARE_bool
(
cinn_use_cuda_vectorize
);
namespace
cinn
{
namespace
hlir
{
namespace
pe
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/ir/schedule/ir_schedule.cc
浏览文件 @
724adf49
...
...
@@ -41,7 +41,7 @@
#include "paddle/cinn/optim/replace_var_with_expr.h"
#include "paddle/cinn/utils/string.h"
DECLARE_int32
(
cinn_error_message_level
);
PD_
DECLARE_int32
(
cinn_error_message_level
);
namespace
cinn
{
namespace
ir
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/runtime/custom_function.cc
浏览文件 @
724adf49
...
...
@@ -22,7 +22,7 @@
#include "paddle/cinn/runtime/flags.h"
#include "paddle/cinn/utils/string.h"
DECLARE_string
(
cinn_check_fusion_accuracy_pass
);
PD_
DECLARE_string
(
cinn_check_fusion_accuracy_pass
);
namespace
cinn
{
namespace
runtime
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/runtime/flags.cc
浏览文件 @
724adf49
...
...
@@ -14,7 +14,6 @@
#include "paddle/cinn/runtime/flags.h"
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <sys/stat.h>
#include <sys/types.h>
...
...
@@ -23,169 +22,182 @@
#include <unordered_set>
#include "paddle/cinn/common/target.h"
#include "paddle/utils/flags.h"
#ifdef CINN_WITH_CUDNN
DEFINE_bool
(
cinn_cudnn_deterministic
,
false
,
"Whether allow using an autotuning algorithm for convolution "
"operator. The autotuning algorithm may be non-deterministic. If "
"true, the algorithm is deterministic."
);
PD_DEFINE_bool
(
cinn_cudnn_deterministic
,
false
,
"Whether allow using an autotuning algorithm for convolution "
"operator. The autotuning algorithm may be non-deterministic. If "
"true, the algorithm is deterministic."
);
#endif
using
::
GFLAGS_NAMESPACE
::
BoolFromEnv
;
using
::
GFLAGS_NAMESPACE
::
DoubleFromEnv
;
using
::
GFLAGS_NAMESPACE
::
Int32FromEnv
;
using
::
GFLAGS_NAMESPACE
::
Int64FromEnv
;
using
::
GFLAGS_NAMESPACE
::
StringFromEnv
;
DEFINE_string
(
cinn_x86_builtin_code_root
,
StringFromEnv
(
"FLAGS_cinn_x86_builtin_code_root"
,
""
),
""
);
DEFINE_string
(
cinn_nvcc_cmd_path
,
StringFromEnv
(
"FLAGS_cinn_nvcc_cmd_path"
,
"/usr/local/cuda/bin"
),
"Setting nvcc default path!"
);
DEFINE_int32
(
cinn_parallel_compile_thread
,
Int32FromEnv
(
"FLAGS_cinn_parallel_compile_thread"
,
(
std
::
thread
::
hardware_concurrency
()
>>
1
)),
"How much thread the parallel compile used."
);
DEFINE_bool
(
cinn_use_op_fusion
,
BoolFromEnv
(
"FLAGS_cinn_use_op_fusion"
,
true
),
"Whether to use op fusion pass."
);
DEFINE_bool
(
general_fusion_merge_pass
,
BoolFromEnv
(
"FLAGS_general_fusion_merge_pass"
,
true
),
"Whether to use general fusion_merge pass."
);
DEFINE_bool
(
cinn_use_common_subexpression_elimination
,
BoolFromEnv
(
"FLAGS_cinn_use_common_subexpression_elimination"
,
false
),
"Whether to use common subexpression elimination pass."
);
DEFINE_string
(
using
::
paddle
::
flags
::
BoolFromEnv
;
using
::
paddle
::
flags
::
DoubleFromEnv
;
using
::
paddle
::
flags
::
Int32FromEnv
;
using
::
paddle
::
flags
::
Int64FromEnv
;
using
::
paddle
::
flags
::
StringFromEnv
;
PD_DEFINE_string
(
cinn_x86_builtin_code_root
,
StringFromEnv
(
"FLAGS_cinn_x86_builtin_code_root"
,
""
),
""
);
PD_DEFINE_string
(
cinn_nvcc_cmd_path
,
StringFromEnv
(
"FLAGS_cinn_nvcc_cmd_path"
,
"/usr/local/cuda/bin"
),
"Setting nvcc default path!"
);
PD_DEFINE_int32
(
cinn_parallel_compile_thread
,
Int32FromEnv
(
"FLAGS_cinn_parallel_compile_thread"
,
(
std
::
thread
::
hardware_concurrency
()
>>
1
)),
"How much thread the parallel compile used."
);
PD_DEFINE_bool
(
cinn_use_op_fusion
,
BoolFromEnv
(
"FLAGS_cinn_use_op_fusion"
,
true
),
"Whether to use op fusion pass."
);
PD_DEFINE_bool
(
general_fusion_merge_pass
,
BoolFromEnv
(
"FLAGS_general_fusion_merge_pass"
,
true
),
"Whether to use general fusion_merge pass."
);
PD_DEFINE_bool
(
cinn_use_common_subexpression_elimination
,
BoolFromEnv
(
"FLAGS_cinn_use_common_subexpression_elimination"
,
false
),
"Whether to use common subexpression elimination pass."
);
PD_DEFINE_string
(
cinn_custom_call_deny_ops
,
StringFromEnv
(
"FLAGS_cinn_custom_call_deny_ops"
,
""
),
"a blacklist of op are denied by MarkCustomCallOps pass, separated by ;"
);
DEFINE_bool
(
cinn_use_custom_call
,
BoolFromEnv
(
"FLAGS_cinn_use_custom_call"
,
true
),
"Whether to use custom_call for ops with external_api registered"
);
PD_DEFINE_bool
(
cinn_use_custom_call
,
BoolFromEnv
(
"FLAGS_cinn_use_custom_call"
,
true
),
"Whether to use custom_call for ops with external_api registered"
);
DEFINE_bool
(
cinn_use_fill_constant_folding
,
BoolFromEnv
(
"FLAGS_cinn_use_fill_constant_folding"
,
false
),
"Whether use the FillConstantFolding pass."
);
PD_
DEFINE_bool
(
cinn_use_fill_constant_folding
,
BoolFromEnv
(
"FLAGS_cinn_use_fill_constant_folding"
,
false
),
"Whether use the FillConstantFolding pass."
);
DEFINE_string
(
cinn_check_fusion_accuracy_pass
,
StringFromEnv
(
"FLAGS_cinn_check_fusion_accuracy_pass"
,
""
),
"Check the correct of fusion kernels, if the results not "
"satisfied 'allclose(rtol=1e-05f, atol=1e-08f)', "
"report error and exited."
);
PD_
DEFINE_string
(
cinn_check_fusion_accuracy_pass
,
StringFromEnv
(
"FLAGS_cinn_check_fusion_accuracy_pass"
,
""
),
"Check the correct of fusion kernels, if the results not "
"satisfied 'allclose(rtol=1e-05f, atol=1e-08f)', "
"report error and exited."
);
DEFINE_bool
(
cinn_use_cuda_vectorize
,
BoolFromEnv
(
"FLAGS_cinn_use_cuda_vectorize"
,
false
),
"Whether use cuda vectroize on schedule config"
);
PD_
DEFINE_bool
(
cinn_use_cuda_vectorize
,
BoolFromEnv
(
"FLAGS_cinn_use_cuda_vectorize"
,
false
),
"Whether use cuda vectroize on schedule config"
);
DEFINE_bool
(
use_reduce_split_pass
,
BoolFromEnv
(
"FLAGS_use_reduce_split_pass"
,
false
),
"Whether use reduce split pass."
);
PD_
DEFINE_bool
(
use_reduce_split_pass
,
BoolFromEnv
(
"FLAGS_use_reduce_split_pass"
,
false
),
"Whether use reduce split pass."
);
DEFINE_bool
(
cinn_use_dense_merge_pass
,
BoolFromEnv
(
"FLAGS_cinn_use_dense_merge_pass"
,
false
),
"Whether use dense merge pass."
);
PD_
DEFINE_bool
(
cinn_use_dense_merge_pass
,
BoolFromEnv
(
"FLAGS_cinn_use_dense_merge_pass"
,
false
),
"Whether use dense merge pass."
);
DEFINE_bool
(
nvrtc_compile_to_cubin
,
BoolFromEnv
(
"FLAGS_nvrtc_compile_to_cubin"
,
false
),
"Whether nvrtc compile cuda source into cubin instead of ptx (only "
"works after cuda-11.1)."
);
PD_DEFINE_bool
(
nvrtc_compile_to_cubin
,
BoolFromEnv
(
"FLAGS_nvrtc_compile_to_cubin"
,
false
),
"Whether nvrtc compile cuda source into cubin instead of ptx (only "
"works after cuda-11.1)."
);
DEFINE_bool
(
cinn_compile_with_nvrtc
,
BoolFromEnv
(
"FLAGS_cinn_compile_with_nvrtc"
,
true
),
"Whether nvrtc compile cuda source with nvrtc(default nvcc)."
);
PD_
DEFINE_bool
(
cinn_compile_with_nvrtc
,
BoolFromEnv
(
"FLAGS_cinn_compile_with_nvrtc"
,
true
),
"Whether nvrtc compile cuda source with nvrtc(default nvcc)."
);
// FLAGS for performance analysis and accuracy debug
DEFINE_bool
(
cinn_sync_run
,
BoolFromEnv
(
"FLAGS_cinn_sync_run"
,
false
),
"Whether sync all devices after each instruction run, which is "
"used for debug."
);
DEFINE_string
(
cinn_self_check_accuracy
,
StringFromEnv
(
"FLAGS_cinn_self_check_accuracy"
,
""
),
"Whether self-check accuracy after each instruction run, which "
"is used for debug."
);
DEFINE_int64
(
cinn_self_check_accuracy_num
,
Int64FromEnv
(
"FLAGS_cinn_self_check_accuracy_num"
,
0L
),
"Set self-check accuracy print numel, which is used for debug."
);
DEFINE_string
(
cinn_fusion_groups_graphviz_dir
,
StringFromEnv
(
"FLAGS_cinn_fusion_groups_graphviz_dir"
,
""
),
"Specify the directory path of dot file of graph, which is used "
"for debug."
);
DEFINE_string
(
cinn_source_code_save_path
,
StringFromEnv
(
"FLAGS_cinn_source_code_save_path"
,
""
),
"Specify the directory path of generated source code, which is "
"used for debug."
);
DEFINE_string
(
cinn_dump_group_lowered_func
,
StringFromEnv
(
"FLAGS_cinn_dump_group_lowered_func"
,
""
),
"Specify the path for dump lowered functions by group, which is "
"used for debug."
);
DEFINE_string
(
PD_DEFINE_bool
(
cinn_sync_run
,
BoolFromEnv
(
"FLAGS_cinn_sync_run"
,
false
),
"Whether sync all devices after each instruction run, which is "
"used for debug."
);
PD_DEFINE_string
(
cinn_self_check_accuracy
,
StringFromEnv
(
"FLAGS_cinn_self_check_accuracy"
,
""
),
"Whether self-check accuracy after each instruction run, which "
"is used for debug."
);
PD_DEFINE_int64
(
cinn_self_check_accuracy_num
,
Int64FromEnv
(
"FLAGS_cinn_self_check_accuracy_num"
,
0L
),
"Set self-check accuracy print numel, which is used for debug."
);
PD_DEFINE_string
(
cinn_fusion_groups_graphviz_dir
,
StringFromEnv
(
"FLAGS_cinn_fusion_groups_graphviz_dir"
,
""
),
"Specify the directory path of dot file of graph, which is used "
"for debug."
);
PD_DEFINE_string
(
cinn_source_code_save_path
,
StringFromEnv
(
"FLAGS_cinn_source_code_save_path"
,
""
),
"Specify the directory path of generated source code, which is "
"used for debug."
);
PD_DEFINE_string
(
cinn_dump_group_lowered_func
,
StringFromEnv
(
"FLAGS_cinn_dump_group_lowered_func"
,
""
),
"Specify the path for dump lowered functions by group, which is "
"used for debug."
);
PD_DEFINE_string
(
cinn_dump_group_source_code
,
StringFromEnv
(
"FLAGS_cinn_dump_group_source_code"
,
""
),
"Specify the path for dump source code by group, which is used for debug."
);
DEFINE_string
(
PD_
DEFINE_string
(
cinn_dump_group_ptx
,
StringFromEnv
(
"FLAGS_cinn_dump_group_ptx"
,
""
),
"Specify the path for dump ptx by group, which is used for debug."
);
DEFINE_string
(
PD_
DEFINE_string
(
cinn_dump_group_instruction
,
StringFromEnv
(
"FLAGS_cinn_dump_group_instruction"
,
""
),
"Specify the path for dump instruction by group, which is used for debug."
);
DEFINE_string
(
cinn_pass_visualize_dir
,
StringFromEnv
(
"FLAGS_cinn_pass_visualize_dir"
,
""
),
"Specify the directory path of pass visualize file of graph, "
"which is used for debug."
);
DEFINE_bool
(
enable_auto_tuner
,
BoolFromEnv
(
"FLAGS_enable_auto_tuner"
,
false
),
"Whether enable auto tuner."
);
DEFINE_bool
(
auto_schedule_use_cost_model
,
BoolFromEnv
(
"FLAGS_auto_schedule_use_cost_model"
,
true
),
"Whether to use cost model in auto schedule, this is an "
"on-developing flag and it will be removed when "
"cost model is stable."
);
DEFINE_bool
(
enhance_vertical_fusion_with_recompute
,
BoolFromEnv
(
"FLAGS_enhance_vertical_fusion_with_recompute"
,
true
),
"Whether to enhance check logic on vertical fusion with recompute"
);
DEFINE_bool
(
verbose_function_register
,
BoolFromEnv
(
"FLAGS_verbose_function_register"
,
false
),
"Whether to verbose function regist log. This will only work if "
"CINN build with flag -DWITH_DEBUG=ON."
);
DEFINE_int32
(
cinn_profiler_state
,
Int32FromEnv
(
"FLAGS_cinn_profiler_state"
,
-
1
),
"Specify the ProfilerState by Int in CINN, 0 for kDisabled, 1 for "
"kCPU, 2 for kCUDA, 3 for kAll, default 0."
);
DEFINE_int32
(
cinn_error_message_level
,
Int32FromEnv
(
"FLAGS_cinn_error_message_level"
,
0
),
"Specify the level of printing error message in the schedule."
"0 means short, 1 means detailed."
);
DEFINE_double
(
cinn_infer_model_version
,
DoubleFromEnv
(
"FLAGS_cinn_infer_model_version"
,
2.0
),
"Paddle has different model format in inference model. We use "
"a flag to load different versions."
);
PD_DEFINE_string
(
cinn_pass_visualize_dir
,
StringFromEnv
(
"FLAGS_cinn_pass_visualize_dir"
,
""
),
"Specify the directory path of pass visualize file of graph, "
"which is used for debug."
);
PD_DEFINE_bool
(
enable_auto_tuner
,
BoolFromEnv
(
"FLAGS_enable_auto_tuner"
,
false
),
"Whether enable auto tuner."
);
PD_DEFINE_bool
(
auto_schedule_use_cost_model
,
BoolFromEnv
(
"FLAGS_auto_schedule_use_cost_model"
,
true
),
"Whether to use cost model in auto schedule, this is an "
"on-developing flag and it will be removed when "
"cost model is stable."
);
PD_DEFINE_bool
(
enhance_vertical_fusion_with_recompute
,
BoolFromEnv
(
"FLAGS_enhance_vertical_fusion_with_recompute"
,
true
),
"Whether to enhance check logic on vertical fusion with recompute"
);
PD_DEFINE_bool
(
verbose_function_register
,
BoolFromEnv
(
"FLAGS_verbose_function_register"
,
false
),
"Whether to verbose function regist log. This will only work if "
"CINN build with flag -DWITH_DEBUG=ON."
);
PD_DEFINE_int32
(
cinn_profiler_state
,
Int32FromEnv
(
"FLAGS_cinn_profiler_state"
,
-
1
),
"Specify the ProfilerState by Int in CINN, 0 for kDisabled, 1 for "
"kCPU, 2 for kCUDA, 3 for kAll, default 0."
);
PD_DEFINE_int32
(
cinn_error_message_level
,
Int32FromEnv
(
"FLAGS_cinn_error_message_level"
,
0
),
"Specify the level of printing error message in the schedule."
"0 means short, 1 means detailed."
);
PD_DEFINE_double
(
cinn_infer_model_version
,
DoubleFromEnv
(
"FLAGS_cinn_infer_model_version"
,
2.0
),
"Paddle has different model format in inference model. We use "
"a flag to load different versions."
);
namespace
cinn
{
namespace
runtime
{
...
...
This diff is collapsed.
Click to expand it.
paddle/cinn/utils/profiler.cc
浏览文件 @
724adf49
...
...
@@ -14,7 +14,7 @@
#include "paddle/cinn/utils/profiler.h"
#include
<gflags/gflags.h>
#include
"paddle/utils/flags.h"
#ifdef CINN_WITH_NVTX
#include <nvToolsExt.h>
...
...
@@ -27,7 +27,7 @@
#endif
#include <chrono>
DECLARE_int32
(
cinn_profiler_state
);
PD_
DECLARE_int32
(
cinn_profiler_state
);
namespace
cinn
{
namespace
utils
{
...
...
This diff is collapsed.
Click to expand it.
paddle/utils/CMakeLists.txt
浏览文件 @
724adf49
if
(
NOT WITH_GFLAGS
)
cc_library
(
paddle_flags SRCS flags_native.cc
)
if
(
CINN_ONLY
)
return
()
endif
()
cc_test
(
flags_native_test
SRCS flags_native_test.cc
DEPS paddle_flags
)
endif
()
add_subdirectory
(
string
)
cc_test
(
...
...
@@ -23,11 +34,3 @@ if(NOT ((NOT WITH_PYTHON) AND ON_INFER))
SRCS pybind.cc
DEPS phi
)
endif
()
if
(
NOT WITH_GFLAGS
)
cc_library
(
paddle_flags SRCS flags_native.cc
)
cc_test
(
flags_native_test
SRCS flags_native_test.cc
DEPS paddle_flags
)
endif
()
This diff is collapsed.
Click to expand it.
paddle/utils/flags.h
浏览文件 @
724adf49
...
...
@@ -73,5 +73,31 @@ inline void AllowUndefinedFlags() { gflags::AllowCommandLineReparsing(); }
using
paddle
::
flags
::
AllowUndefinedFlags
;
#endif
#ifdef PADDLE_WITH_GFLAGS
using
gflags
::
BoolFromEnv
;
using
gflags
::
DoubleFromEnv
;
using
gflags
::
Int32FromEnv
;
using
gflags
::
Int64FromEnv
;
using
gflags
::
StringFromEnv
;
using
gflags
::
UInt32FromEnv
;
using
gflags
::
UInt64FromEnv
;
#else
#define DEFINE_FROM_ENV_FUNC(type, name) \
inline type name##FromEnv(const std::string& env_var_name, \
type default_val) { \
return GetFromEnv(env_var_name, default_val); \
}
DEFINE_FROM_ENV_FUNC
(
bool
,
Bool
);
DEFINE_FROM_ENV_FUNC
(
int32_t
,
Int32
);
DEFINE_FROM_ENV_FUNC
(
uint32_t
,
UInt32
);
DEFINE_FROM_ENV_FUNC
(
int64_t
,
Int64
);
DEFINE_FROM_ENV_FUNC
(
uint64_t
,
UInt64
);
DEFINE_FROM_ENV_FUNC
(
double
,
Double
);
DEFINE_FROM_ENV_FUNC
(
std
::
string
,
String
);
#undef DEFINE_FROM_ENV_FUNC
#endif
}
// namespace flags
}
// namespace paddle
This diff is collapsed.
Click to expand it.
paddle/utils/flags_native.cc
浏览文件 @
724adf49
...
...
@@ -393,6 +393,10 @@ void ParseCommandLineFlags(int* pargc, char*** pargv) {
for
(
size_t
i
=
0
;
i
<
argv_num
;
i
++
)
{
const
std
::
string
&
argv
=
argvs
[
i
];
if
(
argv
.
empty
())
{
continue
;
}
if
(
argv
.
size
()
<
2
||
argv
[
0
]
!=
'-'
)
{
LOG_FLAG_FATAL_ERROR
(
"invalid commandline argument:
\"
"
+
argv
+
"
\"
, "
+
arg_format_help
);
...
...
@@ -480,5 +484,42 @@ void ParseCommandLineFlags(int* pargc, char*** pargv) {
}
}
template
<
typename
T
>
T
GetFromEnv
(
const
std
::
string
&
name
,
const
T
&
default_val
)
{
std
::
string
value_str
;
if
(
GetValueFromEnv
(
name
,
&
value_str
))
{
T
value
;
FlagType
type
=
FlagTypeTraits
<
T
>::
Type
;
Flag
flag
(
"tmp_"
+
name
,
""
,
""
,
type
,
&
value
,
&
value
);
flag
.
SetValueFromString
(
value_str
);
if
(
!
ErrorStream
().
str
().
empty
())
{
ErrorStream
().
str
(
""
);
LOG_FLAG_FATAL_ERROR
(
"value
\"
"
+
value_str
+
"
\"
of environment"
"variable
\"
"
+
name
+
"
\"
is invalid when "
"using GetFromEnv with "
+
FlagType2String
(
type
)
+
" type."
);
}
return
value
;
}
else
{
return
default_val
;
}
}
#define INSTANTIATE_GET_FROM_ENV(type) \
template type GetFromEnv(const std::string& name, const type& default_val)
INSTANTIATE_GET_FROM_ENV
(
bool
);
INSTANTIATE_GET_FROM_ENV
(
int32_t
);
INSTANTIATE_GET_FROM_ENV
(
uint32_t
);
INSTANTIATE_GET_FROM_ENV
(
int64_t
);
INSTANTIATE_GET_FROM_ENV
(
uint64_t
);
INSTANTIATE_GET_FROM_ENV
(
double
);
INSTANTIATE_GET_FROM_ENV
(
std
::
string
);
#undef INSTANTIATE_GET_FROM_ENV
}
// namespace flags
}
// namespace paddle
This diff is collapsed.
Click to expand it.
paddle/utils/flags_native.h
浏览文件 @
724adf49
...
...
@@ -69,6 +69,12 @@ bool FindFlag(const std::string& name);
*/
void
PrintAllFlagHelp
(
bool
to_file
=
false
,
const
std
::
string
&
file_name
=
"all_flags.txt"
);
/**
* @brief Get environment variable. If not found, return default value.
*/
template
<
typename
T
>
T
GetFromEnv
(
const
std
::
string
&
name
,
const
T
&
default_val
);
}
// namespace flags
}
// namespace paddle
...
...
This diff is collapsed.
Click to expand it.
paddle/utils/flags_native_test.cc
浏览文件 @
724adf49
...
...
@@ -34,6 +34,7 @@ void SplitCommandlineArg(const std::string& commandline,
end_pos
=
commandline
.
find
(
' '
,
start_pos
);
args
.
push_back
(
commandline
.
substr
(
start_pos
,
end_pos
-
start_pos
));
}
args
.
push_back
(
""
);
// test empty argument
*
argc
=
args
.
size
();
*
argv
=
new
char
*
[
*
argc
];
for
(
size_t
i
=
0
;
i
<
args
.
size
();
i
++
)
{
...
...
@@ -88,6 +89,11 @@ TEST(flags_native_test, SetFlagsFromEnv) {
ASSERT_TRUE
(
SetEnvVar
(
"FLAGS_paddle_test_env_bool"
,
"true"
));
ASSERT_TRUE
(
SetEnvVar
(
"FLAGS_paddle_test_env_double"
,
"2.71"
));
// test GetFromEnv
ASSERT_EQ
(
GetFromEnv
<
bool
>
(
"FLAGS_paddle_test_env_bool"
,
false
),
true
);
ASSERT_EQ
(
GetFromEnv
<
int32_t
>
(
"FLAGS_int32_not_defined"
,
34
),
34
);
// test SetFlagsFromEnv
std
::
string
commandline
=
"test --fromenv=paddle_test_env_bool,paddle_test_env_double"
;
int
argc
;
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
新手
引导
客服
返回
顶部