Skip to content
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

[Lang] MatrixNdarray refactor part12: Add scalarization for AtomicOpStmt #6312

Merged
merged 6 commits into from
Oct 17, 2022

Conversation

jim19930609
Copy link
Contributor

Related issue = #5873, #5819

This PR is working "Part ④" in #5873.

Before scalarization:

TensorType<4 x i32> val = AtomicStmt(TensorType<4 x i32>* dest,
                                      TensorType<4 x i32>  val)

After scalarization:

i32* dest_ptr_0 = MatrixPtrStmt(dest, 0)
i32* dest_ptr_1 = MatrixPtrStmt(dest, 1)
i32* dest_ptr_2 = MatrixPtrStmt(dest, 2)
i32* dest_ptr_3 = MatrixPtrStmt(dest, 3)

i32 dest_val0 = AtomicStmt(dest_ptr_0,
                            val->cast<MatrixInitStmt>()->val[0])
i32 dest_val1 = AtomicStmt(dest_ptr_1,
                            val->cast<MatrixInitStmt>()->val[1])
i32 dest_val2 = AtomicStmt(dest_ptr_2,
                            val->cast<MatrixInitStmt>()->val[2])
i32 dest_val3 = AtomicStmt(dest_ptr_3,
                            val->cast<MatrixInitStmt>()->val[3])

tmp = MatrixInitStmt(dest_val0, dest_val1,
                      dest_val2, dest_val3)

stmt->replace_all_usages_with(tmp)

@netlify
Copy link

netlify bot commented Oct 13, 2022

Deploy Preview for docsite-preview ready!

Name Link
🔨 Latest commit 6076c74
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/634cb4ab557a4500086668d8
😎 Deploy Preview https://deploy-preview-6312--docsite-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

taichi/ir/frontend_ir.cpp Outdated Show resolved Hide resolved
taichi/ir/frontend_ir.cpp Outdated Show resolved Hide resolved
taichi/transforms/scalarize.cpp Outdated Show resolved Hide resolved
taichi/transforms/scalarize.cpp Outdated Show resolved Hide resolved
jim19930609 and others added 3 commits October 14, 2022 18:22
Co-authored-by: Yi Xu <xy_xuyi@foxmail.com>
Co-authored-by: Yi Xu <xy_xuyi@foxmail.com>
@jim19930609 jim19930609 merged commit 0b893b9 into taichi-dev:master Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants