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

[ir] SNodeOpStmt use GlobalPtrStmt for all SNodeOpTypes #2082

Merged
merged 8 commits into from
Dec 3, 2020

Conversation

xumingkuan
Copy link
Contributor

@xumingkuan xumingkuan commented Dec 2, 2020

Related issue = #742

This PR removes the indices field from SNodeOpStmt.

I have a question in lower_access: what if a global pointer is lowered with activate == false by a SNodeOpStmt or a GlobalLoadStmt, but later we need to activate that pointer?

[Click here for the format server]


@xumingkuan xumingkuan marked this pull request as ready for review December 2, 2020 14:19
Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

Awesome! LGTM, and welcome back!

I have a question in lower_access: what if a global pointer is lowered with activate == false by a SNodeOpStmt or a GlobalLoadStmt, but later we need to activate that pointer?

I'm not exactly sure what "later we need to activate that pointer" refers to, but here's what I remember about the activate flag:

  • When created, each GlobalPtrStmt has activate=true
  • In flag_access (before lower_access), for read-only pointers we mark activate=false

(There doesn't seem to be a place where we mark a pointer with activate=false as activate=true? :-) Correct me if I'm wrong.)

@xumingkuan
Copy link
Contributor Author

Awesome! LGTM, and welcome back!

I have a question in lower_access: what if a global pointer is lowered with activate == false by a SNodeOpStmt or a GlobalLoadStmt, but later we need to activate that pointer?

I'm not exactly sure what "later we need to activate that pointer" refers to, but here's what I remember about the activate flag:

  • When created, each GlobalPtrStmt has activate=true
  • In flag_access (before lower_access), for read-only pointers we mark activate=false

(There doesn't seem to be a place where we mark a pointer with activate=false as activate=true? :-) Correct me if I'm wrong.)

IIUC, flag_access in fact does the following:

  • Mark each GlobalPtrStmt as activate=false
  • For global stores and atomic ops, mark the pointers as activate=true
  • For global pointers with activate=true inside struct fors, mark them as activate=false if they share sparsity with the loop indices

@yuanming-hu yuanming-hu removed the request for review from k-ye December 3, 2020 03:32
@yuanming-hu
Copy link
Member

Awesome! LGTM, and welcome back!

I have a question in lower_access: what if a global pointer is lowered with activate == false by a SNodeOpStmt or a GlobalLoadStmt, but later we need to activate that pointer?

I'm not exactly sure what "later we need to activate that pointer" refers to, but here's what I remember about the activate flag:

  • When created, each GlobalPtrStmt has activate=true
  • In flag_access (before lower_access), for read-only pointers we mark activate=false

(There doesn't seem to be a place where we mark a pointer with activate=false as activate=true? :-) Correct me if I'm wrong.)

IIUC, flag_access in fact does the following:

  • Mark each GlobalPtrStmt as activate=false
  • For global stores and atomic ops, mark the pointers as activate=true
  • For global pointers with activate=true inside struct fors, mark them as activate=false if they share sparsity with the loop indices

This sounds reasonable to me - maybe you can show a specific case where "activate that pointer" becomes problematic?

@xumingkuan
Copy link
Contributor Author

IIUC, flag_access in fact does the following:

  • Mark each GlobalPtrStmt as activate=false
  • For global stores and atomic ops, mark the pointers as activate=true
  • For global pointers with activate=true inside struct fors, mark them as activate=false if they share sparsity with the loop indices

This sounds reasonable to me - maybe you can show a specific case where "activate that pointer" becomes problematic?

I see... I thought each pointer should be lowered only once, but I re-read lower_access and found that it is the operation (global load/store, atomic op, snode op) rather than the pointer that gets replaced (with lowered statements). There should be no problem here.

@xumingkuan xumingkuan merged commit e579ea5 into taichi-dev:master Dec 3, 2020
@k-ye k-ye mentioned this pull request Dec 13, 2020
@xumingkuan xumingkuan deleted the snode-op branch March 13, 2021 12:18
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