[mlir-lsp-server] Only use one MLIRContext per MLIRTextFile
authorRiver Riddle <riddleriver@gmail.com>
Wed, 4 Aug 2021 18:15:50 +0000 (18:15 +0000)
committerRiver Riddle <riddleriver@gmail.com>
Wed, 4 Aug 2021 20:09:07 +0000 (20:09 +0000)
commit0bd297fce2798ce12490a5c67cefbc54061f6bdf
treee852a72d9fc384d93d584e9900ebb143287969b4
parent6ed60fb8a2600e38026b9a9b12fad763cc57c7b2
[mlir-lsp-server] Only use one MLIRContext per MLIRTextFile

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%).

Differential Revision: https://reviews.llvm.org/D107488
mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp