-
Notifications
You must be signed in to change notification settings - Fork 758
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
Conversation
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.
src/ir/properties.h
Outdated
// 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) { |
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.
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. |
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.
// for now be conservative and do not optimize. | |
// for now (TODO) be conservative and do not optimize. |
test/lit/passes/gufa-refs.wast
Outdated
(struct.new_default $A) | ||
) | ||
(drop | ||
;; This is optmizable. |
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.
;; This is optmizable. | |
;; This is optimizable. |
test/lit/passes/gufa-refs.wast
Outdated
) | ||
(drop | ||
;; This is optmizable. | ||
;; TODO: Should it not be optimizable since it reads from shared memory? |
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.
;; 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.
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.