LLVMReactor: Cache llvm::TargetMachines.
We previously created and held a TargetMachine per JITRoutine as the routine could be created with different optimization levels, which is a property used to create the TargetMachine.
However, a llvm::TargetMachine instance can consume a lot of memory and JITRoutines can accumulate in caches, causing dEQP test batches of 1000 to fail as all the system memory is exhausted on low-memory devices.
Optimization level is the only varying property of each TargetMachine, so simply cache these by optimization level on the JITGlobals. Until we start using compiling with different optimization levels, this will ensure a single TargetMachine is shared across all JITRoutines.
Bug: b/137524292
Change-Id: I97298708ea4ed14a81aa8026a51926f571d37148
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/34128
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by:
Nicolas Capens <nicolascapens@google.com>
Reviewed-by:
Chris Forbes <chrisforbes@google.com>
Tested-by:
Ben Clayton <bclayton@google.com>
Showing
Please
register
or
sign in
to comment