CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
【SCU】【Paddle TensorRT No.11、12、65】Add pd_op.bitwise_and
、pd_op.bitwise_or
、pd_op.bitwise_not
converter
#69599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【SCU】【Paddle TensorRT No.11、12、65】Add pd_op.bitwise_and
、pd_op.bitwise_or
、pd_op.bitwise_not
converter
#69599
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
pd_op.bitwise_and
、pd_op.bitwise_or
、pd_op.bitwise_not
converterpd_op.bitwise_and
、pd_op.bitwise_or
、pd_op.bitwise_not
converter
|
||
bool MatchAndRewrite(paddle::dialect::BitwiseOrOp op, | ||
pir::PatternRewriter &rewriter) const override { | ||
#if IS_TRT_VERSION_LT(8400) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个判断条件应该放到外面,并且还缺少了对只支持bool类型
inputs, | ||
trt.ElementWiseOperation.AND, | ||
) | ||
return trt_cast(network, layer_output, inputs[0].dtype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要加trt_cast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已更改
…into add_bitwise_logic
@@ -1701,6 +1701,93 @@ class NotEqualOpPattern | |||
} | |||
}; | |||
|
|||
class BitwiseAndOpPattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这两个Marker代码冗余太多,bitwise_and和bitwise_or
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
要加一句无意义的“_ = layer_output.dtype”不知道为啥,删掉这个语句的话会导致单测报错类型不对。很奇怪。但是加上或者print(layer_output.dtype)就没问题了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
解决一下,为什么要加上这个没用的语句
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
解决一下,为什么要加上这个没用的语句
目前删去这条语句能过CI了
#if IS_TRT_VERSION_LT(8400) | ||
if constexpr (std::is_same_v<OpType, paddle::dialect::BitwiseAndOp>) { | ||
VLOG(3) << "bitwise_and is not supported when TensorRT < 8.4"; | ||
} else if constexpr (std::is_same_v<OpType, paddle::dialect::BitwiseOrOp>) { | ||
VLOG(3) << "bitwise_or is not supported when TensorRT < 8.4"; | ||
} | ||
return false; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PIR-TRT未来只会支持8.5及以上版本,8.5以下的逻辑可以删掉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已删除
Sorry to inform you that 68bed9e's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
…into add_bitwise_logic
ci覆盖率不够,需要补充单测 |
neg_one_tensor = network.add_constant( | ||
neg_one_tensor_dims, neg_one_weights | ||
).get_output(0) | ||
negated = network.add_elementwise( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里因为add_elementwise_layer
里面广播需要paddle_op是二元算子,但这里是一元,为了不修改add_elementwise_layer
就直接用network.add_elementwise
了
应该可以了老师~ |
@@ -52,6 +58,31 @@ def not_equal_converter(network, paddle_op, inputs): | |||
) | |||
not_layer = network.add_unary(layer_output, trt.UnaryOperation.NOT) | |||
layer_output = not_layer.get_output(0) | |||
return trt_cast(network, layer_output, inputs[0].dtype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么要加trt_cast?
negated = network.add_elementwise( | ||
input_tensor, neg_one_tensor, trt.ElementWiseOperation.PROD | ||
).get_output(0) | ||
layer_output = network.add_elementwise( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里neg_one_tensor应该是negated吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里neg_one_tensor应该是negated吧
done,根据原文件改了一下命名
input_tensor, trt.UnaryOperation.NOT | ||
) | ||
layer_output = bitwise_not_layer.get_output(0) | ||
_ = layer_output.dtype |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果是Bool类型,直接返回了,不应该再有_,没用到删除吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
解决一下,为什么要加上这个没用的语句
PR Category
User Experience
PR Types
New features
Description
新增了
pd_op.bitwise_and
、pd_op.bitwise_or
、pd_op.bitwise_not
Marker和Converter(我看前面同学还没做,逻辑一样就和or一起做了)