Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
b2df4c76
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
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看板
未验证
提交
b2df4c76
编写于
6月 21, 2022
作者:
S
Sing_chan
提交者:
GitHub
6月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove .clang-format in paddle/fluid to use the same config (#43678)
上级
f586110d
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
30 addition
and
34 deletion
+30
-34
.clang-format
.clang-format
+2
-0
paddle/fluid/.clang-format
paddle/fluid/.clang-format
+0
-5
paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.cc
...e/fluid/framework/paddle2cinn/cinn_graph_symbolization.cc
+26
-17
paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.h
...le/fluid/framework/paddle2cinn/cinn_graph_symbolization.h
+2
-3
paddle/fluid/framework/paddle2cinn/transform_desc.h
paddle/fluid/framework/paddle2cinn/transform_desc.h
+0
-3
paddle/infrt/dialect/infrt/ir/infrt_dialect.cc
paddle/infrt/dialect/infrt/ir/infrt_dialect.cc
+0
-2
paddle/infrt/tests/models/test_abs.cc
paddle/infrt/tests/models/test_abs.cc
+0
-2
paddle/phi/kernels/gpu/gelu_grad_kernel.cu
paddle/phi/kernels/gpu/gelu_grad_kernel.cu
+0
-2
未找到文件。
.clang-format
浏览文件 @
b2df4c76
...
@@ -24,4 +24,6 @@ Standard: Cpp11
...
@@ -24,4 +24,6 @@ Standard: Cpp11
AllowAllParametersOfDeclarationOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
BinPackParameters: false
BinPackParameters: false
BinPackArguments: false
BinPackArguments: false
IncludeBlocks: Preserve
IncludeIsMainSourceRegex: (\.cu)$
...
...
paddle/fluid/.clang-format
已删除
100644 → 0
浏览文件 @
f586110d
---
Language: Cpp
BasedOnStyle: Google
Standard: Cpp11
...
paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.cc
浏览文件 @
b2df4c76
...
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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. */
// clang-format off
#include "paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.h"
#include "paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.h"
#include <algorithm>
#include <algorithm>
...
@@ -31,7 +30,6 @@ limitations under the License. */
...
@@ -31,7 +30,6 @@ limitations under the License. */
#include "paddle/fluid/framework/convert_utils.h"
#include "paddle/fluid/framework/convert_utils.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/errors.h"
#include "paddle/fluid/platform/errors.h"
// clang-format on
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -79,7 +77,8 @@ FeedInfoMap CinnGraphSymbolization::GetFeedInfoMapFromInput() const {
...
@@ -79,7 +77,8 @@ FeedInfoMap CinnGraphSymbolization::GetFeedInfoMapFromInput() const {
for
(
auto
&
feed_pair
:
input_tensors_
)
{
for
(
auto
&
feed_pair
:
input_tensors_
)
{
const
auto
&
feed_name
=
feed_pair
.
first
;
const
auto
&
feed_name
=
feed_pair
.
first
;
const
auto
*
tensor
=
feed_pair
.
second
;
const
auto
*
tensor
=
feed_pair
.
second
;
PADDLE_ENFORCE_NE
(
tensor
,
nullptr
,
PADDLE_ENFORCE_NE
(
tensor
,
nullptr
,
platform
::
errors
::
PreconditionNotMet
(
platform
::
errors
::
PreconditionNotMet
(
"The input variable %s's tensor cannot be NULL,"
"The input variable %s's tensor cannot be NULL,"
"we need the variable's dtype and shape from tensor."
,
"we need the variable's dtype and shape from tensor."
,
...
@@ -96,7 +95,8 @@ FeedInfoMap CinnGraphSymbolization::GetFeedInfoMapFromInput() const {
...
@@ -96,7 +95,8 @@ FeedInfoMap CinnGraphSymbolization::GetFeedInfoMapFromInput() const {
}
}
PADDLE_ENFORCE_NE
(
PADDLE_ENFORCE_NE
(
feed_map
[
feed_name
].
shape
.
size
(),
0UL
,
feed_map
[
feed_name
].
shape
.
size
(),
0UL
,
platform
::
errors
::
PreconditionNotMet
(
platform
::
errors
::
PreconditionNotMet
(
"The input variable %s's tensor shape cannot be empty,"
"The input variable %s's tensor shape cannot be empty,"
"we need the variable's dtype and shape from tensor."
,
"we need the variable's dtype and shape from tensor."
,
...
@@ -136,7 +136,8 @@ CinnGraphSymbolization::CreateCinnScope(const FeedInfoMap& feed_map) {
...
@@ -136,7 +136,8 @@ CinnGraphSymbolization::CreateCinnScope(const FeedInfoMap& feed_map) {
for
(
const
auto
&
param_name
:
parameter_names
)
{
for
(
const
auto
&
param_name
:
parameter_names
)
{
PADDLE_ENFORCE_GT
(
PADDLE_ENFORCE_GT
(
feed_map
.
count
(
param_name
),
0UL
,
feed_map
.
count
(
param_name
),
0UL
,
platform
::
errors
::
NotFound
(
"Cannot find parameter %s from input list,"
platform
::
errors
::
NotFound
(
"Cannot find parameter %s from input list,"
"please add the tensor into input."
,
"please add the tensor into input."
,
param_name
.
c_str
()));
param_name
.
c_str
()));
...
@@ -162,8 +163,8 @@ CinnGraphSymbolization::CreateCinnScope(const FeedInfoMap& feed_map) {
...
@@ -162,8 +163,8 @@ CinnGraphSymbolization::CreateCinnScope(const FeedInfoMap& feed_map) {
std
::
vector
<
Node
*>
CinnGraphSymbolization
::
TopologicalSort
()
const
{
std
::
vector
<
Node
*>
CinnGraphSymbolization
::
TopologicalSort
()
const
{
std
::
unordered_set
<
Node
*>
op_nodes
;
std
::
unordered_set
<
Node
*>
op_nodes
;
std
::
for_each
(
graph_
.
Nodes
().
begin
(),
graph_
.
Nodes
().
end
(),
std
::
for_each
(
[
&
op_nodes
](
Node
*
n
)
{
graph_
.
Nodes
().
begin
(),
graph_
.
Nodes
().
end
(),
[
&
op_nodes
](
Node
*
n
)
{
if
(
n
->
IsOp
())
{
if
(
n
->
IsOp
())
{
op_nodes
.
emplace
(
n
);
op_nodes
.
emplace
(
n
);
}
}
...
@@ -210,7 +211,8 @@ std::vector<Node*> CinnGraphSymbolization::TopologicalSort() const {
...
@@ -210,7 +211,8 @@ std::vector<Node*> CinnGraphSymbolization::TopologicalSort() const {
}
}
}
}
PADDLE_ENFORCE_EQ
(
sorted_ops
.
size
(),
op_nodes
.
size
(),
PADDLE_ENFORCE_EQ
(
sorted_ops
.
size
(),
op_nodes
.
size
(),
platform
::
errors
::
PreconditionNotMet
(
platform
::
errors
::
PreconditionNotMet
(
"The sorting graph contains cycles."
));
"The sorting graph contains cycles."
));
return
sorted_ops
;
return
sorted_ops
;
...
@@ -234,7 +236,8 @@ void CinnGraphSymbolization::RunOp(const CinnOpDesc& op_desc,
...
@@ -234,7 +236,8 @@ void CinnGraphSymbolization::RunOp(const CinnOpDesc& op_desc,
const
OpMapperContext
&
ctx
)
const
{
const
OpMapperContext
&
ctx
)
const
{
const
auto
&
op_type
=
op_desc
.
Type
();
const
auto
&
op_type
=
op_desc
.
Type
();
auto
*
kernel
=
::
cinn
::
frontend
::
OpMapperRegistry
::
Global
()
->
Find
(
op_type
);
auto
*
kernel
=
::
cinn
::
frontend
::
OpMapperRegistry
::
Global
()
->
Find
(
op_type
);
PADDLE_ENFORCE_NE
(
kernel
,
nullptr
,
PADDLE_ENFORCE_NE
(
kernel
,
nullptr
,
platform
::
errors
::
NotFound
(
platform
::
errors
::
NotFound
(
"Op %s is Not Supported by CINN, please register"
"Op %s is Not Supported by CINN, please register"
" this op in the CINN repo."
,
" this op in the CINN repo."
,
...
@@ -256,10 +259,12 @@ std::unordered_set<std::string> CinnGraphSymbolization::GetFetchIds() const {
...
@@ -256,10 +259,12 @@ std::unordered_set<std::string> CinnGraphSymbolization::GetFetchIds() const {
std
::
unordered_set
<
std
::
string
>
fetch_names
;
std
::
unordered_set
<
std
::
string
>
fetch_names
;
fetch_names
.
reserve
(
fetch_var_names_
.
size
());
fetch_names
.
reserve
(
fetch_var_names_
.
size
());
std
::
for_each
(
std
::
for_each
(
fetch_var_names_
.
begin
(),
fetch_var_names_
.
end
(),
fetch_var_names_
.
begin
(),
fetch_var_names_
.
end
(),
[
this
,
&
fetch_names
](
const
std
::
string
&
name
)
{
[
this
,
&
fetch_names
](
const
std
::
string
&
name
)
{
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
var_model_to_program_map_
.
count
(
name
),
1
,
var_model_to_program_map_
.
count
(
name
),
1
,
platform
::
errors
::
PreconditionNotMet
(
platform
::
errors
::
PreconditionNotMet
(
"Cannot find %s in var_model_to_program_map_"
,
name
.
c_str
()));
"Cannot find %s in var_model_to_program_map_"
,
name
.
c_str
()));
fetch_names
.
insert
(
var_model_to_program_map_
.
at
(
name
));
fetch_names
.
insert
(
var_model_to_program_map_
.
at
(
name
));
...
@@ -276,8 +281,12 @@ std::unordered_set<std::string> CinnGraphSymbolization::GetFetchIds() const {
...
@@ -276,8 +281,12 @@ std::unordered_set<std::string> CinnGraphSymbolization::GetFetchIds() const {
auto
feed_map
=
GetFeedInfoMapFromInput
();
auto
feed_map
=
GetFeedInfoMapFromInput
();
auto
cinn_scope
=
CreateCinnScope
(
feed_map
);
auto
cinn_scope
=
CreateCinnScope
(
feed_map
);
OpMapperContext
ctx
(
*
cinn_scope
,
target_
,
&
builder
,
&
var_map_
,
OpMapperContext
ctx
(
*
cinn_scope
,
&
var_model_to_program_map_
,
&
fetch_var_names_
);
target_
,
&
builder
,
&
var_map_
,
&
var_model_to_program_map_
,
&
fetch_var_names_
);
// add all tensor's feed info into context
// add all tensor's feed info into context
for
(
auto
&
feed_pair
:
feed_map
)
{
for
(
auto
&
feed_pair
:
feed_map
)
{
ctx
.
AddFeedInfo
(
feed_pair
.
first
,
feed_pair
.
second
);
ctx
.
AddFeedInfo
(
feed_pair
.
first
,
feed_pair
.
second
);
...
...
paddle/fluid/framework/paddle2cinn/cinn_graph_symbolization.h
浏览文件 @
b2df4c76
...
@@ -14,7 +14,6 @@ limitations under the License. */
...
@@ -14,7 +14,6 @@ limitations under the License. */
#pragma once
#pragma once
// clang-format off
#include <map>
#include <map>
#include <string>
#include <string>
#include <unordered_map>
#include <unordered_map>
...
@@ -27,7 +26,6 @@ limitations under the License. */
...
@@ -27,7 +26,6 @@ limitations under the License. */
#include "cinn/frontend/net_builder.h"
#include "cinn/frontend/net_builder.h"
#include "cinn/frontend/op_mapper_registry.h"
#include "cinn/frontend/op_mapper_registry.h"
// clang-format on
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -65,7 +63,8 @@ namespace paddle2cinn {
...
@@ -65,7 +63,8 @@ namespace paddle2cinn {
class
CinnGraphSymbolization
{
class
CinnGraphSymbolization
{
public:
public:
CinnGraphSymbolization
(
CinnGraphSymbolization
(
int64_t
graph_id
,
const
ir
::
Graph
&
graph
,
int64_t
graph_id
,
const
ir
::
Graph
&
graph
,
const
::
cinn
::
common
::
Target
&
target
,
const
::
cinn
::
common
::
Target
&
target
,
const
std
::
map
<
std
::
string
,
const
LoDTensor
*>&
input_tensors
)
const
std
::
map
<
std
::
string
,
const
LoDTensor
*>&
input_tensors
)
:
graph_id_
(
graph_id
),
:
graph_id_
(
graph_id
),
...
...
paddle/fluid/framework/paddle2cinn/transform_desc.h
浏览文件 @
b2df4c76
...
@@ -14,8 +14,6 @@
...
@@ -14,8 +14,6 @@
#pragma once
#pragma once
// The headers cant be sorted by clang-format or compilint error occurs.
// clang-format off
#include "paddle/fluid/framework/block_desc.h"
#include "paddle/fluid/framework/block_desc.h"
#include "paddle/fluid/framework/op_desc.h"
#include "paddle/fluid/framework/op_desc.h"
#include "paddle/fluid/framework/program_desc.h"
#include "paddle/fluid/framework/program_desc.h"
...
@@ -26,7 +24,6 @@
...
@@ -26,7 +24,6 @@
#include "cinn/frontend/paddle/cpp/op_desc.h"
#include "cinn/frontend/paddle/cpp/op_desc.h"
#include "cinn/frontend/paddle/cpp/program_desc.h"
#include "cinn/frontend/paddle/cpp/program_desc.h"
#include "cinn/frontend/paddle/cpp/var_desc.h"
#include "cinn/frontend/paddle/cpp/var_desc.h"
// clang-format on
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
...
paddle/infrt/dialect/infrt/ir/infrt_dialect.cc
浏览文件 @
b2df4c76
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +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.
// clang-format off
#include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h"
#include "paddle/infrt/dialect/infrt/ir/infrt_dialect.h"
#include <llvm/ADT/TypeSwitch.h>
#include <llvm/ADT/TypeSwitch.h>
...
@@ -61,7 +60,6 @@ void InfrtDialect::initialize() {
...
@@ -61,7 +60,6 @@ void InfrtDialect::initialize() {
#include "paddle/infrt/dialect/infrt/ir/test_kernels.cpp.inc"
#include "paddle/infrt/dialect/infrt/ir/test_kernels.cpp.inc"
>
();
>
();
}
}
// clang-format on
/// Parse a type registered to this dialect.
/// Parse a type registered to this dialect.
mlir
::
Type
InfrtDialect
::
parseType
(
::
mlir
::
DialectAsmParser
&
parser
)
const
{
mlir
::
Type
InfrtDialect
::
parseType
(
::
mlir
::
DialectAsmParser
&
parser
)
const
{
...
...
paddle/infrt/tests/models/test_abs.cc
浏览文件 @
b2df4c76
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +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.
// clang-format off
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <llvm/Support/CommandLine.h>
#include <llvm/Support/CommandLine.h>
#include <mlir/Pass/PassManager.h>
#include <mlir/Pass/PassManager.h>
...
@@ -50,7 +49,6 @@
...
@@ -50,7 +49,6 @@
#include "paddle/infrt/dialect/phi/ir/infrt_phi_tensor.h"
#include "paddle/infrt/dialect/phi/ir/infrt_phi_tensor.h"
#include "paddle/infrt/dialect/phi/ir/phi_base.h"
#include "paddle/infrt/dialect/phi/ir/phi_base.h"
#include "paddle/infrt/dialect/phi/ir/phi_kernels.h"
#include "paddle/infrt/dialect/phi/ir/phi_kernels.h"
// clang-format on
static
llvm
::
cl
::
list
<
std
::
string
>
cl_shared_libs
(
// NOLINT
static
llvm
::
cl
::
list
<
std
::
string
>
cl_shared_libs
(
// NOLINT
"shared_libs"
,
"shared_libs"
,
...
...
paddle/phi/kernels/gpu/gelu_grad_kernel.cu
浏览文件 @
b2df4c76
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +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.
// clang-format off
#include "paddle/phi/kernels/gelu_kernel.h"
#include "paddle/phi/kernels/gelu_kernel.h"
#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/backends/gpu/gpu_context.h"
...
@@ -21,7 +20,6 @@
...
@@ -21,7 +20,6 @@
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/funcs/broadcast_function.h"
#include "paddle/phi/kernels/funcs/broadcast_function.h"
#include "paddle/phi/kernels/gpu/gelu_funcs.h"
#include "paddle/phi/kernels/gpu/gelu_funcs.h"
// clang-format on
DECLARE_bool
(
use_fast_math
);
DECLARE_bool
(
use_fast_math
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录