Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
69ab2700
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
69ab2700
编写于
3月 01, 2022
作者:
A
Allen Guo
提交者:
GitHub
3月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix compiling and running with ipu (#39920)
上级
09039636
变更
5
展开全部
显示空白变更内容
内联
并排
Showing
5 changed file
with
231 addition
and
166 deletion
+231
-166
paddle/fluid/framework/phi_utils.cc
paddle/fluid/framework/phi_utils.cc
+9
-0
paddle/fluid/platform/device/ipu/ipu_strategy.cc
paddle/fluid/platform/device/ipu/ipu_strategy.cc
+175
-131
paddle/fluid/platform/device/ipu/ipu_strategy.h
paddle/fluid/platform/device/ipu/ipu_strategy.h
+37
-35
paddle/fluid/pybind/pybind.cc
paddle/fluid/pybind/pybind.cc
+2
-0
python/paddle/fluid/tests/unittests/ipu/CMakeLists.txt
python/paddle/fluid/tests/unittests/ipu/CMakeLists.txt
+8
-0
未找到文件。
paddle/fluid/framework/phi_utils.cc
浏览文件 @
69ab2700
...
@@ -125,6 +125,15 @@ phi::KernelKey FallBackToCpu(const OpKernelType& expected_kernel_key,
...
@@ -125,6 +125,15 @@ phi::KernelKey FallBackToCpu(const OpKernelType& expected_kernel_key,
return
phi
::
KernelKey
(
phi
::
Backend
::
CPU
,
kernel_key
.
layout
(),
return
phi
::
KernelKey
(
phi
::
Backend
::
CPU
,
kernel_key
.
layout
(),
kernel_key
.
dtype
());
kernel_key
.
dtype
());
}
}
#endif
#ifdef PADDLE_WITH_IPU
if
(
platform
::
is_ipu_place
(
expected_kernel_key
.
place_
))
{
VLOG
(
3
)
<<
"pten missing IPU kernel: "
<<
op
.
Type
()
<<
", expected_kernel_key:"
<<
expected_kernel_key
<<
", fallbacking to CPU one!"
;
return
phi
::
KernelKey
(
phi
::
Backend
::
CPU
,
kernel_key
.
layout
(),
kernel_key
.
dtype
());
}
#endif
#endif
return
phi
::
KernelKey
();
return
phi
::
KernelKey
();
}
}
...
...
paddle/fluid/platform/device/ipu/ipu_strategy.cc
浏览文件 @
69ab2700
此差异已折叠。
点击以展开。
paddle/fluid/platform/device/ipu/ipu_strategy.h
浏览文件 @
69ab2700
...
@@ -24,7 +24,8 @@ namespace paddle {
...
@@ -24,7 +24,8 @@ namespace paddle {
namespace
platform
{
namespace
platform
{
namespace
ipu
{
namespace
ipu
{
struct
IpuStrategy
{
class
IpuStrategy
{
public:
IpuStrategy
();
IpuStrategy
();
// TODO(alleng) create PaddleOptions
// TODO(alleng) create PaddleOptions
...
@@ -75,22 +76,30 @@ struct IpuStrategy {
...
@@ -75,22 +76,30 @@ struct IpuStrategy {
// custom ops
// custom ops
std
::
vector
<
IpuCustomOpIdentifier
>
custom_ops
;
std
::
vector
<
IpuCustomOpIdentifier
>
custom_ops
;
private:
public:
std
::
map
<
std
::
string
,
std
::
function
<
void
(
bool
)
>>
bool_options
;
void
AddBoolOption
(
const
std
::
string
&
option
,
bool
value
);
std
::
map
<
std
::
string
,
std
::
function
<
void
(
std
::
uint64_t
)
>>
uint64_options
;
void
AddUint64Option
(
const
std
::
string
&
option
,
std
::
uint64_t
value
);
std
::
map
<
std
::
string
,
std
::
function
<
void
(
double
)
>>
double_options
;
void
AddDoubleOption
(
const
std
::
string
&
option
,
double
value
);
std
::
map
<
std
::
string
,
std
::
function
<
void
(
std
::
string
)
>>
string_options
;
void
AddStringOption
(
const
std
::
string
&
option
,
const
std
::
string
&
value
);
std
::
map
<
std
::
string
,
void
InsertStringOption
(
const
std
::
string
&
option
,
const
std
::
string
&
value
);
std
::
function
<
void
(
std
::
pair
<
std
::
string
,
std
::
string
>
)
>>
void
InsertStringPairOption
(
const
std
::
string
&
option
,
const
std
::
string
&
key
,
container_options
;
const
std
::
string
&
value
);
void
SetTensorLocation
(
const
std
::
string
&
tensor
,
const
std
::
string
&
option
,
std
::
uint64_t
value
);
void
AddCustomOp
(
const
std
::
string
&
paddle_op
,
const
std
::
string
&
popart_op
,
const
std
::
string
&
domain
,
int
version
);
std
::
map
<
std
::
string
,
std
::
function
<
std
::
string
()
>>
options_getter
;
std
::
string
GetOption
(
const
std
::
string
&
);
std
::
map
<
std
::
string
,
std
::
function
<
std
::
vector
<
std
::
string
>
()
>>
std
::
vector
<
std
::
string
>
GetVectorOption
(
const
std
::
string
&
);
vector_options_getter
;
std
::
map
<
std
::
string
,
std
::
string
>
GetMapOption
(
const
std
::
string
&
);
std
::
map
<
std
::
string
,
std
::
function
<
std
::
map
<
std
::
string
,
std
::
string
>
()
>>
std
::
string
GetOptionType
(
const
std
::
string
&
);
map_options_getter
;
std
::
vector
<
std
::
string
>
GetAllOptionNames
();
std
::
map
<
std
::
string
,
std
::
string
>
options_type
;
void
EnablePattern
(
const
std
::
string
&
t
);
void
DisablePattern
(
const
std
::
string
&
t
);
const
bool
IsPatternEnabled
(
const
std
::
string
&
t
);
private:
template
<
typename
ValueType
>
template
<
typename
ValueType
>
void
set
(
void
set
(
const
std
::
string
&
key
,
ValueType
value
,
const
std
::
string
&
key
,
ValueType
value
,
...
@@ -117,27 +126,20 @@ struct IpuStrategy {
...
@@ -117,27 +126,20 @@ struct IpuStrategy {
return
it
->
second
();
return
it
->
second
();
}
}
public:
std
::
map
<
std
::
string
,
std
::
function
<
void
(
bool
)
>>
bool_options
;
void
AddBoolOption
(
const
std
::
string
&
option
,
bool
value
);
std
::
map
<
std
::
string
,
std
::
function
<
void
(
std
::
uint64_t
)
>>
uint64_options
;
void
AddUint64Option
(
const
std
::
string
&
option
,
std
::
uint64_t
value
);
std
::
map
<
std
::
string
,
std
::
function
<
void
(
double
)
>>
double_options
;
void
AddDoubleOption
(
const
std
::
string
&
option
,
double
value
);
std
::
map
<
std
::
string
,
std
::
function
<
void
(
std
::
string
)
>>
string_options
;
void
AddStringOption
(
const
std
::
string
&
option
,
const
std
::
string
&
value
);
std
::
map
<
std
::
string
,
void
InsertStringOption
(
const
std
::
string
&
option
,
const
std
::
string
&
value
);
std
::
function
<
void
(
std
::
pair
<
std
::
string
,
std
::
string
>
)
>>
void
InsertStringPairOption
(
const
std
::
string
&
option
,
const
std
::
string
&
key
,
container_options
;
const
std
::
string
&
value
);
void
SetTensorLocation
(
const
std
::
string
&
tensor
,
const
std
::
string
&
option
,
std
::
uint64_t
value
);
void
AddCustomOp
(
const
std
::
string
&
paddle_op
,
const
std
::
string
&
popart_op
,
const
std
::
string
&
domain
,
int
version
);
std
::
string
GetOption
(
const
std
::
string
&
);
std
::
vector
<
std
::
string
>
GetVectorOption
(
const
std
::
string
&
);
std
::
map
<
std
::
string
,
std
::
string
>
GetMapOption
(
const
std
::
string
&
);
std
::
string
GetOptionType
(
const
std
::
string
&
);
void
EnablePattern
(
const
std
::
string
&
t
);
std
::
map
<
std
::
string
,
std
::
function
<
std
::
string
()
>>
options_getter
;
void
DisablePattern
(
const
std
::
string
&
t
);
std
::
map
<
std
::
string
,
std
::
function
<
std
::
vector
<
std
::
string
>
()
>>
const
bool
IsPatternEnabled
(
const
std
::
string
&
t
);
vector_options_getter
;
std
::
map
<
std
::
string
,
std
::
function
<
std
::
map
<
std
::
string
,
std
::
string
>
()
>>
map_options_getter
;
std
::
map
<
std
::
string
,
std
::
string
>
options_type
;
};
};
}
// namespace ipu
}
// namespace ipu
...
...
paddle/fluid/pybind/pybind.cc
浏览文件 @
69ab2700
...
@@ -3919,6 +3919,8 @@ All parameter, weight, gradient are variables in Paddle.
...
@@ -3919,6 +3919,8 @@ All parameter, weight, gradient are variables in Paddle.
}
}
return
res
;
return
res
;
})
})
.
def
(
"get_all_option_names"
,
&
platform
::
ipu
::
IpuStrategy
::
GetAllOptionNames
)
.
def
(
"enable_pattern"
,
&
platform
::
ipu
::
IpuStrategy
::
EnablePattern
)
.
def
(
"enable_pattern"
,
&
platform
::
ipu
::
IpuStrategy
::
EnablePattern
)
.
def
(
"disable_pattern"
,
&
platform
::
ipu
::
IpuStrategy
::
DisablePattern
)
.
def
(
"disable_pattern"
,
&
platform
::
ipu
::
IpuStrategy
::
DisablePattern
)
.
def
(
"is_pattern_enabled"
,
&
platform
::
ipu
::
IpuStrategy
::
IsPatternEnabled
);
.
def
(
"is_pattern_enabled"
,
&
platform
::
ipu
::
IpuStrategy
::
IsPatternEnabled
);
...
...
python/paddle/fluid/tests/unittests/ipu/CMakeLists.txt
0 → 100644
浏览文件 @
69ab2700
if
(
WITH_IPU
)
file
(
GLOB TEST_OPS RELATIVE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"test_*.py"
)
string
(
REPLACE
".py"
""
TEST_OPS
"
${
TEST_OPS
}
"
)
foreach
(
TEST_OP
${
TEST_OPS
}
)
py_test_modules
(
${
TEST_OP
}
MODULES
${
TEST_OP
}
)
endforeach
(
TEST_OP
)
endif
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录