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

ensure that double stores to tape do not incure additional mallocs #1472

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tthsqe12
Copy link
Contributor

Previous version of enzyme vacillated between (1) storing double directly on the tape, and (2) storing a malloc(8) pointer on the tape and then storing the double in this new pointer. Since (1) is greatly to be preferred from a performance and memory consumption perspective, this test is meant to ensure that enzyme doesn't regress again in this aspect.

@tthsqe12
Copy link
Contributor Author

@wsmoses It looks like enzyme now stores doubles directly on the tape (yay!), and this is what I am checking here. However, I have seen it - in the case of caching some integer quantities - doing the unnecessary extra indirection:

tape = malloc(...)
int* p = malloc(sizeof(int))
*(tape + some_offset) = p
// now use *p as the cache

There is no need to do this as the int can live directly on the tape. Could you possibly look into eliminating more of these extra fixed-size mallocs? I can give examples if needs be.

MilesCranmer pushed a commit to MilesCranmer/Enzyme that referenced this pull request Jul 24, 2024
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.

1 participant