CARVIEW |
Select Language
HTTP/2 200
date: Wed, 23 Jul 2025 18:34:29 GMT
content-type: text/html; charset=utf-8
cache-control: no-cache
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
referrer-policy: no-referrer-when-downgrade
server-timing: pull_request_layout-fragment;desc="pull_request_layout fragment";dur=285.331659,conversation_content-fragment;desc="conversation_content fragment";dur=566.430078,conversation_sidebar-fragment;desc="conversation_sidebar fragment";dur=267.640781,nginx;desc="NGINX";dur=1.36537,glb;desc="GLB";dur=101.543425
strict-transport-security: max-age=31536000; includeSubdomains; preload
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-content-type-options: nosniff
x-frame-options: deny
x-voltron-version: fd8fbbc
x-xss-protection: 0
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=fPGZot9VNamSk75YfcUKFygp0qyCPYF6QKxOcdKseDIESt6Np0U89SqTt%2BnfXFYHQbNYKQuMNIZrwnx96BbEkSbrkCbZxhp%2B854lHvoU1OxkBrYOmXeZHvRE0UUYTXK64kXMp1V%2B8XvsHYkj30vB70CDWNA8oel3lxuuvtswDBumxxf8sKESHQICpAshm6Z8CU9hxbYQIRFlXczFwdx8MC9kdzhU%2FSXdJ%2BqRivGEwGTdTu6WfoimW4TmEhxEW4yhQdqAwc%2F1upoo5eQl42L1xA%3D%3D--ga4NaylJGkxkN7qh--Lm7RrRksODjqqrG3SZbnlQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.26600212.1753295668; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 18:34:28 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 18:34:28 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: E380:EE750:13F62:18618:68812B34
[PHI][CINN] Align linalg.solve kernel with torch by lshpku · Pull Request #72608 · PaddlePaddle/Paddle · GitHub
lshpku
force-pushed
the
fix-linalg-solve
branch
2 times, most recently
from
May 8, 2025 07:03
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[PHI][CINN] Align linalg.solve kernel with torch #72608
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
Merged
Merged
+175
−50
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
你的PR提交成功,感谢你对开源项目的贡献! |
caa4e2d
to
ad9dc8f
Compare
wanghuancoder
approved these changes
May 9, 2025
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.
LGTM
GITD245
pushed a commit
to GITD245/Paddle
that referenced
this pull request
May 14, 2025
wanghuancoder
pushed a commit
to wanghuancoder/Paddle
that referenced
this pull request
May 27, 2025
wanghuancoder
added a commit
that referenced
this pull request
Jun 3, 2025
* refine forrange (#72360) * refine forrange * refine forrange * reduce support big tensor (#71970) * reduce support big tensor * [PHI] Fix gridDim limit for reduce kernel (#72507) * [API] isclose support bigtensor (#72516) * isclose support bigtensor * refine * [API] isnan isinf isfinite support bigtensor (#72517) * isnan isinf isfinite support bigtensor * refine * [PHI] Fix cum kernel for big tensor (#72562) * [PHI] Preliminary fix for elementwise broadcast int32 shape overflow (#72584) * [PHI] Align linalg.solve kernel with torch (#72608) * Update strided copy kernel (#72662) * [PHI] Fix grid sample kernel for big tensor (#72628) * [PHI] Fix argsort big tensor bug (#72712) * [PHI] Fixed argsort big tensor bug * [PHI] Fixed shape mismatch problem. * [PHI] Fix contiguous kernel for big tensor (#72705) * [PHI] Fix flatten and split kernel for big tensor (#72634) * [PHI] Fix out-of-bound issue of paddle.take_along_axis (#72757) * [PHI] fix paddle.diag with big tensor (#72638) * [API] fix paddle.cross with big tensor (#72652) * [PHI] Fix paddle.where api for big tensor (#72717) * [PHI] Fix bincount kernel for big tensor (#72706) * fix bincount kernel for big tensor * use HostAlloc to alloc memory * add cpu test case * [PHI] Fix full_like kernel for big tensor (#72831) * [API] Fix int overflow and float16 support for paddle.frac (#72815) * [PHI] Align paddle.inner with torch in matmul logic (#72843) * [PHI] Fix paddle.var & paddle.std float16 overflow (#72650) * [PHI] Fix logsumexp precision problem (#72681) * [PHI] Debug for logsumexp, bug source found * [PHI] Removed GetNumBlocks func to get correct logsumexp * [PHI] Removed redundant debug VLOG * [PHI] Elegant grid bounded solution * [Accuracy diff No.55-56、76-77] Fix accuracy diff for var&std API (#72879) * [Accuracy diff No.21] Fix accuracy diff for heaviside API (#72894) --------- Co-authored-by: Shuhao Liang <50269654+lshpku@users.noreply.github.com> Co-authored-by: Qianyue He <46109954+Enigmatisms@users.noreply.github.com> Co-authored-by: Lei Ding <69283446+Dmovic@users.noreply.github.com> Co-authored-by: ggggxm <66855582+ggggxm@users.noreply.github.com> Co-authored-by: xkkkkkk23 <xiekeke@baidu.com> Co-authored-by: Zx <zhangxiao35@baidu.com> Co-authored-by: huangjiyi <43315610+huangjiyi@users.noreply.github.com> Co-authored-by: ooo oo <106524776+ooooo-create@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
You can’t perform that action at this time.
PR Category
Operator Mechanism
PR Types
Bug fixes
Description
与torch对齐
paddle.linalg.solve
的调用逻辑,提升数百倍性能,并修复大Tensor下的报错简介
linalg.solve用于求解矩阵方程
A @ X = B
,其中A[batch_size, n, n],X[batch_size, n, nrhs],B[batch_size, n, nrhs](batch_size可以没有或者是多维)求解方法
首先对A做PLU分解,得到
P @ A = L @ U
;其中P是一个permutation矩阵(实际实现中使用pivot数组记录),L是一个对角线全为1的下三角矩阵,U是一个上三角矩阵然后将
P @ A = L @ U
做等价变换得到A = P^T @ L @ U
,然后将A带入原来的方程A @ X = B
中,得到P^T @ L @ U @ X = B
接下来把P^T移到右边,得到
L @ U @ X = P @ B
,由于P是一个permutation矩阵,因此这步只需要scatter操作即可,不需要真的矩阵乘最后进行两次triangular求解,将L和U依次移动到右边,即
L @ U @ X = P @ B
==第1次求解=>U @ X = L^-1 @ P @ B
==第2次求解=>X = U^-1 @ L^-1 @ P @ B
此时
X = U^-1 @ L^-1 @ P @ B
即是方程的解注:由于cublas使用列优先存储,而paddle使用行优先,出于性能考虑并没有对A在输入时进行转置(和torch保持一致),因此上述公式中A实际上是A^T,实际求解方程是
X = P^T @ L^T^-1 @ U^T^-1 @ B
,cublas调用方法大致相同,只是顺序不同执行过程
参考torch实现:lu_solve_kernel
与torch对齐情况
关于int使用的说明
注意到,我在kernel中很多地方没有把int转成int64_t,包括n、nrhs,这是因为:
Pcard-85711