[LLVMdev] Making LLVM safer in out-of-memory situations
Gasiunas, Vaidas
vaidas.gasiunas at sap.com
Thu Jan 9 08:43:57 PST 2014
Hi James,
I don't think that would be a suitable approach for us. First, it requires a reliable way to estimate the memory to be consumed by a particular program. Our experience is that compiler behavior depends not only on the size of the program, but also on its structure. So I don't think there is also a simple relationship between the size of the program and the memory consumed. Second, we have multiple threads running in parallel, also multiple parallel compilations. Thus even if we check the memory before compilation, the situation can change later during compilation process. It is also not possible to reserve memory for a particular LLVM compilation, because in most of places it uses the global allocator.
Regards,
Vaidas
-----Original Message-----
From: James Courtier-Dutton [mailto:james.dutton at gmail.com]
Sent: Donnerstag, 9. Januar 2014 16:50
To: Gasiunas, Vaidas
Cc: LLVM Dev
Subject: Re: [LLVMdev] Making LLVM safer in out-of-memory situations
On 12 December 2013 12:25, Gasiunas, Vaidas <vaidas.gasiunas at sap.com> wrote:
> Hello,
>
> Philipp Becker and me, Vaidas Gasiunas, are developers at SAP and part of a team developing a C-like domain-specific language for the SAP HANA in-memory database. We use LLVM as a backend to translate our language to native code, primarily on x86-64 platforms. Our programs are created dynamically, compiled and optimized in a running database. As a result of that we have special requirements with respect to response time and safety. In particular, we have to avoid long compile times and must deal with error situations like out-of-memory without crashing or producing memory leaks in the compiler. The compiler performance is especially important since that we must compile generated functions which tend to be rather long - in the range of thousands of LOC per function.
>
> To address these requirements we have developed a set of patches improving performance and malfunction safety of certain compiler passes and would be interested in contributing them at some point. Before proposing concrete changes, we would like to know what the general interest is with respect to making LLVM safer in out-of-memory situations.
>
Did you look into another way of looking at this.
E.g. I have source code X. I have 1 Gig of RAM and no SWAP file. Will
LLVM compile it or run out of memory in the process?
Running LLVM and being able to retrieve stats like "Max RAM used
during compile" might be a workable solution to mitigate the
likelihood of OOM.
The reason I am interested in this is that cloud computing sometimes
gives you cheap Virtual Machines with quite low limits for resources
like RAM.
It would be nice to know before trying to compile some source code,
that it will not fail due to OOM before you start.
Kind Regards
James
More information about the llvm-dev
mailing list