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

Do not optimize atomic gets in GUFA #7161

Merged
merged 2 commits into from
Dec 20, 2024
Merged

Do not optimize atomic gets in GUFA #7161

merged 2 commits into from
Dec 20, 2024

Conversation

tlively
Copy link
Member

@tlively tlively commented Dec 19, 2024

Conservatively avoid introducing synchronization bugs by not optimizing
atomic struct.gets at all in GUFA. It is possible that we could be more
precise in the future.

Also remove obsolete logic dealing with the types of null values as a
drive-by. All null values now have bottom types, so the type mismatch
this code checked for is impossible.

Conservatively avoid introducing synchronization bugs by not optimizing
atomic struct.gets at all in GUFA. It is possible that we could be more
precise in the future.

Also remove obsolete logic dealing with the types of null values as a
drive-by. All null values now have bottom types, so the type mismatch
this code checked for is impossible.
@tlively tlively requested a review from kripken December 19, 2024 05:39
// shared memory synchronization, return the memory order corresponding to the
// kind of synchronization it does. Return MemoryOrder::Unordered if there is no
// synchronization. Does not look at children.
inline MemoryOrder getSynchronization(Expression* curr) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not getMemoryOrder since that is what it returns?

// synchronize with that store anymore. Since we know what value the store
// must write, and we know it is the same as every other store to the same
// location, it's possible that optimizing here would be allowable, but
// for now be conservative and do not optimize.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// for now be conservative and do not optimize.
// for now (TODO) be conservative and do not optimize.

(struct.new_default $A)
)
(drop
;; This is optmizable.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
;; This is optmizable.
;; This is optimizable.

)
(drop
;; This is optmizable.
;; TODO: Should it not be optimizable since it reads from shared memory?
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
;; TODO: Should it not be optimizable since it reads from shared memory?

I think this is optimizable. GUFA has seen that all writes to this type+field combination all write the same value, hence this field can only contain one value. That value might also be written from another thread, but that's fine.

@tlively tlively merged commit 7c42700 into main Dec 20, 2024
12 of 13 checks passed
@tlively tlively deleted the gufa-atomics branch December 20, 2024 01:45
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