radeon/compute: Stop leaking LLVMContexts in radeon_llvm_parse_bitcode
authorAaron Watry <awatry@gmail.com>
Thu, 12 Dec 2013 22:34:09 +0000 (16:34 -0600)
committerAaron Watry <awatry@gmail.com>
Mon, 23 Dec 2013 13:24:50 +0000 (07:24 -0600)
commit8c9a9205d96b5ac0718218bfa952a5b4b6ad939c
tree089a1cf74b6d22561955441e93a6dfc38f374d60
parenta7653c19a3b1adae162864587a7ab1c17ab256e6
radeon/compute: Stop leaking LLVMContexts in radeon_llvm_parse_bitcode

Previously we were creating a new LLVMContext every time that we called
radeon_llvm_parse_bitcode, which caused us to leak the context every time
that we compiled a CL program.

Sadly, we can't dispose of the LLVMContext at the point that it was being
created because evergreen_launch_grid (and possibly the SI equivalent) was
assuming that the context used to compile the kernels was still available.

Now, we'll create a new LLVMContext when creating EG/SI compute state, store
it there, and pass it to all of the places that need it.

The LLVM Context gets destroyed when we delete the EG/SI compute state.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
CC: "10.0" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/r600/evergreen_compute.c
src/gallium/drivers/r600/evergreen_compute_internal.h
src/gallium/drivers/radeon/radeon_llvm_util.c
src/gallium/drivers/radeon/radeon_llvm_util.h
src/gallium/drivers/radeonsi/radeonsi_compute.c