This is an archive of the discontinued LLVM Phabricator instance.

[mlir-lsp-server] Only use one MLIRContext per MLIRTextFile
ClosedPublic

Authored by rriddle on Aug 4 2021, 11:16 AM.

Details

Summary

A text file may be comprised of many different "chunks", when
the input file contains the // ----- split markers. We don't
need to use a unique MLIRContext per chunk, as having
separate contexts is intended to allow for easy unloading of
unused data and all chunks have the same lifetime (tied to the
input file). This commit uses one context for the entire file,
greatly reducing memory consumption in certain situations (up
to 70%).

Diff Detail

Event Timeline

rriddle created this revision.Aug 4 2021, 11:16 AM
rriddle requested review of this revision.Aug 4 2021, 11:16 AM
jpienaar accepted this revision.Aug 4 2021, 11:25 AM

And this doesn't affect the error cases? E.g., split is often used when testing for errors reported, so using 1 context doesn't affect that

This revision is now accepted and ready to land.Aug 4 2021, 11:25 AM

And this doesn't affect the error cases? E.g., split is often used when testing for errors reported, so using 1 context doesn't affect that

Yeah, having one context doesn't affect diagnostics or anything related to split really (if it does, that's probably a bug somewhere). The context only really holds immutable state, so everything should still work the same before.

This revision was landed with ongoing or failed builds.Aug 4 2021, 1:10 PM
This revision was automatically updated to reflect the committed changes.