On Thu, Aug 21, 2014 at 08:20:57AM -0500, Aaron Watry wrote: > On Thu, Aug 21, 2014 at 6:46 AM, Tom Stellard <thomas.stell...@amd.com> wrote: > > From: Michel Dänzer <michel.daen...@amd.com> > > > > v2: Tom Stellard > > - Properly destroy the Module > > --- > > src/gallium/state_trackers/clover/llvm/invocation.cpp | 16 ++++++++++++++-- > > 1 file changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp > > b/src/gallium/state_trackers/clover/llvm/invocation.cpp > > index 5d2efc4..d351bc5 100644 > > --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp > > +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp > > @@ -234,7 +234,11 @@ namespace { > > memcpy(address_spaces, c.getTarget().getAddressSpaceMap(), > > > > sizeof(address_spaces)); > > > > +#if HAVE_LLVM >= 0x0306 > > + return act.takeModule().release(); > > +#else > > return act.takeModule(); > > +#endif > > } > > > > void > > @@ -415,13 +419,21 @@ clover::compile_program_llvm(const compat::string > > &source, > > > > internalize_functions(mod, kernels); > > > > + module m; > > // Build the clover::module > > switch (ir) { > > case PIPE_SHADER_IR_TGSI: > > //XXX: Handle TGSI > > assert(0); > > - return module(); > > + m = module(); > > + break; > > default: > > - return build_module_llvm(mod, kernels, address_spaces); > > + m = build_module_llvm(mod, kernels, address_spaces); > > + break; > > } > > +#if HAVE_LLVM >= 0x0306 > > + // LLVM 3.6 and newer, the user takes ownership of the module. > > + delete mod; > > +#endif > > + return m; > > } > > This is tested-by: Aaron Watry <awa...@gmail.com> > > It's basically one line different from a patch I was going to send > last night before I ran out of time.... The only thing that I was > still trying to track down was this possible leak in valgrind that I > was not sure if this patch caused or if it was a pre-existing issue: > > Command: > valgrind --leak-check=full ~/src/piglit/bin/cl-program-tester > ~/src/piglit/tests/cl/program/execute/vload-int.cl >
There is a similar valgrind error that shows up in bug in https://bugs.freedesktop.org/show_bug.cgi?id=81837 which was filed a few weeks ago. See https://bugs.freedesktop.org/attachment.cgi?id=104338 -Tom > ==15596== 55 bytes in 1 blocks are possibly lost in loss record 182 of 355 > ==15596== at 0x4C2B0E0: operator new(unsigned long) (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==15596== by 0xC4A53B8: std::string::_Rep::_S_create(unsigned long, > unsigned long, std::allocator<char> const&) (in > /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19) > ==15596== by 0xBAB1339: > llvm::TimerGroup::TimerGroup(llvm::StringRef) (in > /usr/local/lib/libLLVM-3.6svn.so) > ==15596== by 0xBAB170F: llvm::Timer::init(llvm::StringRef) (in > /usr/local/lib/libLLVM-3.6svn.so) > ==15596== by 0x9CEC0B2: > clang::CodeGenAction::CreateASTConsumer(clang::CompilerInstance&, > llvm::StringRef) (in /usr/local/lib/libMesaOpenCL.so.1.0.0) > ==15596== by 0x9BF6D1E: > clang::FrontendAction::CreateWrappedASTConsumer(clang::CompilerInstance&, > llvm::StringRef) (in /usr/local/lib/libMesaOpenCL.so.1.0.0) > ==15596== by 0x9BF7BD4: > clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, > clang::FrontendInputFile const&) (in > /usr/local/lib/libMesaOpenCL.so.1.0.0) > ==15596== by 0x9BD82BF: > clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (in > /usr/local/lib/libMesaOpenCL.so.1.0.0) > ==15596== by 0x9B89E71: (anonymous > namespace)::compile(llvm::LLVMContext&, std::string const&, > std::string const&, std::string const&, std::string const&, > std::string const&, unsigned int (&) [6], clover::compat::string&) > (invocation.cpp:227) > ==15596== by 0x9B8C9C6: > clover::compile_program_llvm(clover::compat::string const&, > pipe_shader_ir, clover::compat::string const&, clover::compat::string > const&, clover::compat::string&) (invocation.cpp:416) > ==15596== by 0x9B64600: > clover::program::build(clover::ref_vector<clover::device> const&, char > const*) (program.cpp:62) > ==15596== by 0x9B81F63: clBuildProgram (program.cpp:173) > > --Aaron > > > -- > > 1.8.5.5 > > > > _______________________________________________ > > mesa-dev mailing list > > mesa-dev@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev