Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Add triangular solve op #1224

Merged
merged 11 commits into from
Mar 3, 2023
Merged

Conversation

zzk0
Copy link
Contributor

@zzk0 zzk0 commented Feb 24, 2023

No.82:为神经网络编译器 CINN 增加 triangular_solve 算子

在 cublas 里面,矩阵使用列优先,而 CINN 用的行优先,所以要对计算的公式的两边做转置。

$$AX = B$$

变成了

$$X^T A^T = B^T$$

输入的参数:

  • left_side: 反过来取值,经过转置,参数矩阵从左边变到了右边
  • upper: 参数矩阵原本取上半部分,转置之后要去下半部分
  • transpose_a: 保持不变,因为和上述逻辑不冲突。
  • unit_diagonal: 这个参数更加不相干了。

@zzk0 zzk0 changed the title Triangular solve Add triangular solve op Feb 24, 2023
@zzk0
Copy link
Contributor Author

zzk0 commented Feb 25, 2023

@thisjiang 您好~可以帮忙看看这个算子吗?单测 Paddle-CINN-CI 没有通过,检测 docker md5 失败了, 应该如何解决?

2023-02-25 09:06:06 PADDLE DOCKER BUILD md5=
2023-02-25 09:06:06 check docker md5 fail !
2023-02-25 09:06:06 the build(e11a4192b0744ead905e75f1520b6a74) state is BUILD_CODE_FAIL

@thisjiang
Copy link
Collaborator

@thisjiang 您好~可以帮忙看看这个算子吗?单测 Paddle-CINN-CI 没有通过,检测 docker md5 失败了, 应该如何解决?

2023-02-25 09:06:06 PADDLE DOCKER BUILD md5=
2023-02-25 09:06:06 check docker md5 fail !
2023-02-25 09:06:06 the build(e11a4192b0744ead905e75f1520b6a74) state is BUILD_CODE_FAIL

这个CI不用管,目前还在开发阶段,只用Required的CI通过了就行

@zzk0 zzk0 requested review from thisjiang and removed request for thisjiang February 28, 2023 08:03
@zzk0
Copy link
Contributor Author

zzk0 commented Mar 1, 2023

@thisjiang 可以麻烦看看 PR 吗?

  • 更新了测试用例,覆盖了更多 case
  • 更新了实现逻辑,支持 broadcast

cinn/frontend/net_builder.cc Outdated Show resolved Hide resolved
cinn/hlir/op/contrib/triangular_solve.cc Outdated Show resolved Hide resolved
cinn/runtime/cuda/cuda_util.cc Show resolved Hide resolved
cinn/runtime/cuda/cuda_util.cc Outdated Show resolved Hide resolved
python/tests/ops/test_triangular_solve_op.py Show resolved Hide resolved
@zzk0 zzk0 requested a review from thisjiang March 2, 2023 02:29
Copy link
Collaborator

@thisjiang thisjiang left a comment

Choose a reason for hiding this comment

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

LGTM

@zzk0 zzk0 requested a review from thisjiang March 3, 2023 00:43
@thisjiang thisjiang merged commit b3591cd into PaddlePaddle:develop Mar 3, 2023
BiynXu pushed a commit to BiynXu/CINN that referenced this pull request Mar 8, 2023
* add triangular solve op

* add tests

* update cublas call

* post pre-commit ;)

* post-commit ;)

* conditional compilation for triangular solve test

* update test cases && add broadcast

* update test case for left_side=False && remove header

* update left_side=False test cast

* update singular test case

* refine broadcast
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants