-
Notifications
You must be signed in to change notification settings - Fork 106
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
[WIP] add new operator LU factorization #1019
base: master
Are you sure you want to change the base?
Changes from 16 commits
174c324
4ee4991
b27298a
6fa1c3a
4cad120
53eeaa2
1660b84
011e361
0b7367a
fcaa1ee
0f952c4
0a6e901
482cc91
e29ae50
d4c63ef
1a2a2dc
020b081
1f0ec6c
73ccad1
7cc42eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -793,3 +793,10 @@ mluOpLgamma | |||||
|
||||||
- ``x`` 为输入张量。 | ||||||
|
||||||
.. Sgetrf2:: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .. Sgetrf2::>>>.. _sgetrf2: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 这个能具体解释一下吗 |
||||||
|
||||||
mluOpSgetrf2 | ||||||
--------------- | ||||||
执行 LU 分解,将一个矩阵分解为一个下三角矩阵(L)和一个上三角矩阵(U),参数``mode``用来指定是否进行选主元操作。 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 这个是什么意思? |
||||||
|
||||||
ArtIntAI marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
该算子包含7个输入:handle 为操作句柄,x_desc 与 x 分别描述并提供输入矩阵的信息;两个输出:y_desc 与 y 分别描述并存储输出矩阵的信息;此外,还包含一个参数 mode,用于指定是否进行选主元,值为0表示选择非主元模式,ipiv表示置换矩阵,以及一个 workspace 用于临时存储计算过程中的数据。 | ||||||
shunshen93 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 有公式的话,需要补充下公式。
Suggested change
》》7个输入中提到了三个(handle,x_desc和x)?mode、ipiv和workspace也是输入吗? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 已修改 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/************************************************************************* | ||
* Copyright (C) [2022] by Cambricon, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*************************************************************************/ | ||
#include "sgetrf2.h" | ||
#include "sgetrf2_utils.h" | ||
#include "core/logging.h" | ||
#include "kernels/debug.h" | ||
#include "kernels/kernel.h" | ||
|
||
__mlu_entry__ void MLUKernelMyCnrtMemcpy2D(int batch, int m, int n, float *dA, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MLUKernelMyCnrtMemcpy2D建议去掉名字中的my,其他出现的类似的也删除my吧 |
||
int ldda, int stride_a, float *dB, | ||
int lddb, int stride_b, int mode) { | ||
int id, batch_id, tx, taskdim; | ||
|
||
if (batch > 1) { | ||
id = taskId; | ||
batch_id = id / 4; | ||
if (batch_id >= batch) return; | ||
tx = taskId % 4; | ||
dA += batch_id * stride_a; | ||
dB += batch_id * stride_b; | ||
taskdim = TaskUnion1; | ||
} else { | ||
id = taskId; | ||
batch_id = 0; | ||
taskdim = taskDim; | ||
tx = taskId; | ||
} | ||
if (tx == 0) | ||
__memcpy(dB, dA, n * sizeof(float), GDRAM2GDRAM, lddb * sizeof(float), | ||
ldda * sizeof(float), m - 1); | ||
} | ||
|
||
mluOpStatus_t MLUOP_WIN_API KernelMyCnrtMemcpy2D( | ||
cnrtDim3_t k_dim, cnrtFunctionType_t k_type, cnrtQueue_t queue, | ||
mluOpDataType_t d_type, int batch, int m, int n, float *dA, int ldda, | ||
int stride_a, float *dB, int lddb, int stride_b, int mode) { | ||
KERNEL_CHECK(MLUKernelMyCnrtMemcpy2D<<<k_dim, k_type, queue>>>( | ||
batch, m, n, dA, ldda, stride_a, dB, lddb, stride_b, mode)); | ||
|
||
return MLUOP_STATUS_SUCCESS; | ||
} |
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.
.. Sgetrf2::这个是多写了?
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.
已修改