Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Do not compute the IDF for all blocks in advance #15146

Merged
merged 1 commit into from
Mar 17, 2018

Conversation

mikedn
Copy link

@mikedn mikedn commented Nov 21, 2017

InsertsPhiFunctions visits each block only once so there's no need to
compute and store the IDFs for all blocks in advance. The IDF of a given
block can be computed when the block is visited and discarded after
that. This way a single BlkVector can be reused for all blocks.

This saves 12% CMK_SSA memory.

MemStats diff: https://gist.github.com/mikedn/d5fb13e06f181f29de420510fd07d7d9

No jit diffs.

@mikedn mikedn changed the title [WIP] Do not compute the IDF for all blocks in advance Do not compute the IDF for all blocks in advance Nov 23, 2017
InsertsPhiFunctions visits each block only once so there's no need to compute and store the IDFs for all blocks in advance. The IDF of a given block can be computed when the block is visited and discarded after that. This way a single BlkVector can be reused for all blocks.
@@ -439,10 +439,7 @@ void vector<T, Allocator>::clear()
{
m_pArray[i].~T();
}
m_allocator.deallocate(m_pArray, m_nCapacity);
m_pArray = NULL;
Copy link
Author

Choose a reason for hiding this comment

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

vector::clear() is not required to release the memory. Doing this prevents memory reuse.

@mikedn
Copy link
Author

mikedn commented Nov 24, 2017

cc @dotnet/jit-contrib

@mikedn
Copy link
Author

mikedn commented Dec 13, 2017

@dotnet-bot test CentOS7.1 x64 Checked Innerloop Build and Test

@sandreenko
Copy link

LGTM, thank you.

@CarolEidt
Copy link

NIce! Not only does this save memory, it improves readability as well, especially with the addition of the header comments.

@sandreenko sandreenko merged commit 3968088 into dotnet:master Mar 17, 2018
@mikedn mikedn deleted the ssa-mem-idf branch March 25, 2018 10:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants