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

Reduce memory footprint of nGraph #1296

Merged
merged 4 commits into from
Jul 8, 2019
Merged

Reduce memory footprint of nGraph #1296

merged 4 commits into from
Jul 8, 2019

Conversation

rgesteve
Copy link
Contributor

Description: CMake changes to properly configure ngraph build.

Motivation and Context
Memory use of the onnxruntime (using the ngraph EP) on Windows is higher than it is on Linux. The included change attempts to narrow this gap.

@rgesteve rgesteve requested a review from a team as a code owner June 26, 2019 15:44
@pranavsharma
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 22 pipeline(s).

@pranavsharma
Copy link
Contributor

Can you quantify how much improvement this patch achieves?

@skottmckay
Copy link
Contributor

Do we need to patch or could we update the ngraph version we're using instead?

@jywu-msft
Copy link
Member

Updating ngraph version is a bigger effort. I believe there are other issues with newer ngraph versions that are being tracked as separate issues.

Copy link
Member

@jywu-msft jywu-msft left a comment

Choose a reason for hiding this comment

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

Remove email header?

@jfdong
Copy link

jfdong commented Jun 27, 2019

@jywu-msft we will remove the header.
@pranavsharma the impact of this fix is to avoid unnecessary memory allocation for 1x1 convolution. It is backported the existing MKL-DNN commit of oneapi-src/oneDNN@3b96d63.
For resnet-50 model (from https://s3.amazonaws.com/download.onnx/models/opset_9/resnet50.tar.gz). After applying this fix, the memory footprint on my CLX test machine is 1.12GB (release) and 1.13GB (Debug). Before that fix, it is about 3.72GB. My test machine is Cascade Lake server.

@skottmckay I agree with @jywu-msft , there is bigger effort of nGraph update. This patch will help during the interim.

@rgesteve rgesteve changed the title This patch includes @jfdong's fix to the memory overuse in mkldnn. Reduce memory footprint of nGraph Jun 28, 2019
@pranavsharma
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 22 pipeline(s).

@sreekanth-yalachigere
Copy link
Contributor

@jywu-msft @pranavsharma
This MKL-DNN patch for nGraph also reduces MKL-DNN EP memory usage significantly. Thanks

@pranavsharma
Copy link
Contributor

@jywu-msft not merging this yet in case you want to run some tests or have other concerns.

@jywu-msft
Copy link
Member

@jdfong thanks for the CLX numbers. Would it be possible for you to verify and provide expected numbers on AVX2 (on older system such as Haswell/Broadwell) One if our devs wasn't able to repro the resnet50 memory behavior on his system with AVX2.
Memory consumption was 1GB with or without the fix.

@jywu-msft
Copy link
Member

@sreekanth-yalachigere re: your comment about mkl-dnn EP mem usage,
This PR only patches mkl-dnn used by ngraph right?
Wouldn't you need to apply same patch for mkl-dnn ep? Or upgrade mkl-dnn version...

Copy link
Member

@jywu-msft jywu-msft left a comment

Choose a reason for hiding this comment

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

these changes look. good. we should look at further reducing memory footprint. goal is to be as close to default cpu provider as possible.

@jywu-msft jywu-msft merged commit 93528d9 into microsoft:master Jul 8, 2019
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.

6 participants