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