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

Selective cachereads #21

Merged
merged 22 commits into from
Nov 7, 2019
Merged

Selective cachereads #21

merged 22 commits into from
Nov 7, 2019

Conversation

timkaler
Copy link
Contributor

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.

@timkaler timkaler changed the title Selective cachereads rebase Selective cachereads Oct 31, 2019
enzyme/Enzyme/EnzymeLogic.h Show resolved Hide resolved
enzyme/Enzyme/FunctionUtils.cpp Show resolved Hide resolved
enzyme/functional_tests_c/Makefile Outdated Show resolved Hide resolved
enzyme/Enzyme/EnzymeLogic.cpp Outdated Show resolved Hide resolved
enzyme/Enzyme/EnzymeLogic.cpp Show resolved Hide resolved
enzyme/Enzyme/EnzymeLogic.cpp Show resolved Hide resolved
enzyme/Enzyme/EnzymeLogic.cpp Show resolved Hide resolved
enzyme/Enzyme/EnzymeLogic.cpp Show resolved Hide resolved
enzyme/Enzyme/EnzymeLogic.cpp Show resolved Hide resolved
enzyme/Enzyme/EnzymeLogic.cpp Outdated Show resolved Hide resolved
@timkaler
Copy link
Contributor Author

timkaler commented Nov 5, 2019

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.

@@ -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.
Copy link
Member

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

Copy link
Contributor Author

@timkaler timkaler Nov 5, 2019

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.

Copy link
Contributor Author

@timkaler timkaler Nov 5, 2019

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.

@timkaler timkaler merged commit 59a0e15 into plugin Nov 7, 2019
@vchuravy vchuravy deleted the selective-cachereads-rebase branch October 4, 2020 21:18
ludgerpaehler pushed a commit that referenced this pull request May 16, 2021
* 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.
ludgerpaehler pushed a commit that referenced this pull request May 16, 2021
* 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.
ludgerpaehler pushed a commit that referenced this pull request May 16, 2021
* 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.
wsmoses pushed a commit that referenced this pull request May 17, 2021
* 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.
@rem1A rem1A mentioned this pull request Sep 6, 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.

None yet

2 participants