-
Notifications
You must be signed in to change notification settings - Fork 100
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
Selective cachereads #21
Conversation
…gle function when checking for modrefs
… we can avoid caching loads is correct though
… logic for more conservative detection of uncacheable loads
fe6fc67
to
532cf59
Compare
There are two flags to force "always caching" and "never caching" of loads. Let's try not to use them though, especially in any CI tests. I don't think the logic is so conservative as to make it common for loads to be cached unnecessarily. This is ready to be merged. We need to move onto other things that depend on correct load caching, and ought to be separate pull requests. |
enzyme/Enzyme/ActiveVariable.cpp
Outdated
@@ -152,7 +152,8 @@ bool isIntASecretFloat(Value* val) { | |||
if (!pointerUse && floatingUse) return true; | |||
llvm::errs() << *inst->getParent()->getParent() << "\n"; | |||
llvm::errs() << " val:" << *val << " pointer:" << pointerUse << " floating:" << floatingUse << "\n"; | |||
assert(0 && "ambiguous unsure if constant or not"); | |||
//assert(0 && "ambiguous unsure if constant or not"); | |||
return false; // NOTE(TFK): Return false instead of asset. |
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 should error otherwise there is likely incorrect behavior
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.
Yea didn't intend to include that.
Fixed.
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.
There's another change I didn't intend to include in EnzymeLogic.cpp --- the change with placeholder values being erased. Can you double check that change. Can just leave it in if its correct.
* Enable cache reads by default, which is needed for correctness. * Selectively omit caching for reads whose value does not change after the load instruction. Loads that are modified after the load instruction are called "uncacheable" in the code. * Propagate the uncacheable status of pointer arguments to calls. * readwriteread C test illustrates behavior of code.
* Enable cache reads by default, which is needed for correctness. * Selectively omit caching for reads whose value does not change after the load instruction. Loads that are modified after the load instruction are called "uncacheable" in the code. * Propagate the uncacheable status of pointer arguments to calls. * readwriteread C test illustrates behavior of code.
* Enable cache reads by default, which is needed for correctness. * Selectively omit caching for reads whose value does not change after the load instruction. Loads that are modified after the load instruction are called "uncacheable" in the code. * Propagate the uncacheable status of pointer arguments to calls. * readwriteread C test illustrates behavior of code.
* Enable cache reads by default, which is needed for correctness. * Selectively omit caching for reads whose value does not change after the load instruction. Loads that are modified after the load instruction are called "uncacheable" in the code. * Propagate the uncacheable status of pointer arguments to calls. * readwriteread C test illustrates behavior of code.
There are a few more tweaks needed before this is ready, e.g. I need to add ordering constraints to the modref analysis within a function (like is done for finding "volatile" arguments), and also handle pointers of unknown origin. I want to write the tests before doing these fixes though.