Skip to content

Commit a43fada

Browse files
cyber-pioneerWanglongzhi2001
authored andcommitted
[Prim][PIR] Set prim gflag for pure cpp (PaddlePaddle#60505)
* inference support decomp * polish code * add decomp base define * add decomp base define2 * change decomp infer * fix symbol overload * fix test case * debug * debug * decomp add debug info * add cpp flag * revert * remove unused flag
1 parent abe64d6 commit a43fada

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

paddle/fluid/prim/utils/utils.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@
1717
#include "paddle/fluid/prim/utils/static/static_global_utils.h"
1818

1919
PADDLE_DEFINE_EXPORTED_bool(prim_enabled, false, "enable_prim or not");
20+
PADDLE_DEFINE_EXPORTED_bool(prim_all, false, "enable prim_all or not");
21+
PADDLE_DEFINE_EXPORTED_bool(prim_forward, false, "enable prim_forward or not");
22+
PADDLE_DEFINE_EXPORTED_bool(prim_backward, false, "enable prim_backward not");
23+
2024
namespace paddle {
2125
namespace prim {
2226
bool PrimCommonUtils::IsBwdPrimEnabled() {
23-
return StaticCompositeContext::Instance().IsBwdPrimEnabled();
27+
bool res = StaticCompositeContext::Instance().IsBwdPrimEnabled();
28+
return res || FLAGS_prim_all || FLAGS_prim_backward;
2429
}
2530

2631
void PrimCommonUtils::SetBwdPrimEnabled(bool enable_prim) {
@@ -36,7 +41,8 @@ void PrimCommonUtils::SetEagerPrimEnabled(bool enable_prim) {
3641
}
3742

3843
bool PrimCommonUtils::IsFwdPrimEnabled() {
39-
return StaticCompositeContext::Instance().IsFwdPrimEnabled();
44+
bool res = StaticCompositeContext::Instance().IsFwdPrimEnabled();
45+
return res || FLAGS_prim_all || FLAGS_prim_forward;
4046
}
4147

4248
void PrimCommonUtils::SetFwdPrimEnabled(bool enable_prim) {

0 commit comments

Comments
 (0)