Skip to content

Conversation

DrRyanHuang
Copy link
Contributor

@DrRyanHuang DrRyanHuang commented Sep 13, 2023

PR types

Others

PR changes

Others

Description

op.name() == "XX" 优化为op.isa()

@paddle-bot
Copy link

paddle-bot bot commented Sep 13, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Sep 13, 2023
@Aurelius84 Aurelius84 changed the title [NewIR] op.name() == "XX" 优化为 op.isa<XXOp>() [PIR] op.name() == "XX" 优化为 op.isa<XXOp>() Sep 13, 2023
@DrRyanHuang
Copy link
Contributor Author

不好意思,问一下,这个 pd_op.h 文件为啥会不存在呢? 😭😭😭

2023-09-13 22:49:18 /workspace/Paddle/paddle/pir/transforms/dead_code_elimination_pass.cc:16:10: fatal error: paddle/fluid/pir/dialect/operator/ir/pd_op.h: No such file or directory
2023-09-13 22:49:18  #include "paddle/fluid/pir/dialect/operator/ir/pd_op.h"
2023-09-13 22:49:18           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2023-09-13 22:49:18 compilation terminated.```

Aurelius84
Aurelius84 previously approved these changes Sep 15, 2023
Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DrRyanHuang

This comment was marked as off-topic.

@DrRyanHuang
Copy link
Contributor Author

不好意思,问一下,这个 pd_op.h 文件为啥会不存在呢? 😭😭😭

2023-09-13 22:49:18 /workspace/Paddle/paddle/pir/transforms/dead_code_elimination_pass.cc:16:10: fatal error: paddle/fluid/pir/dialect/operator/ir/pd_op.h: No such file or directory
2023-09-13 22:49:18  #include "paddle/fluid/pir/dialect/operator/ir/pd_op.h"
2023-09-13 22:49:18           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2023-09-13 22:49:18 compilation terminated.```

转自 @Aurelius84

去看了CMake的target_include_directories 命令介绍,以及对比了其他include pd_op.h 的编译单元,我的猜测是:

pd_op_to_kernel_pass 所在目录的CMakeLists.txt 中在编译这个pass时DEPS的是 pd_op_dialect_core。pd_op_dialect_core这个本身没有包含pd_op.h,因为之前op->name() 是通过字符串判断的,所以没有问题。

现在你在PR里引入了pd_op.h,但第一个include_directories 包含pd_op.h 的target是 pd_op_dialect_api,且从Cmake 相关文档来看,依赖pd_op_dialect_api的其他target也会自动包含这个头文件,但pd_op_dialect_core是更下层的target,导致没有自动 include pd_op.h

所以一种可能得解决方式是:在编译 pd_op_to_kernel_pass时,让其DEPS pd_op_dialect_api或 pd_op_dialect 即可。

可能需要把 include 的Scope作用域提升一级,改为下面这种:

target_include_directories(pd_op_dialect_api INTERFACE ${PD_DIALECT_BINARY_DIR})

详见:https://stackoverflow.com/questions/26243169/cmake-target-include-directories-meaning-of-scope_

Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aurelius84 Aurelius84 merged commit 99c9c8f into PaddlePaddle:develop Sep 18, 2023
Frida-a pushed a commit to Frida-a/Paddle that referenced this pull request Oct 14, 2023
* op->name  =>  op->isa

* del Instrunction

* add include  pd_op.h

* fix include file

* add ()

* PRIVATE => INTERFACE

* pd_op_dialect_core => pd_op_dialect
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
* op->name  =>  op->isa

* del Instrunction

* add include  pd_op.h

* fix include file

* add ()

* PRIVATE => INTERFACE

* pd_op_dialect_core => pd_op_dialect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants