Re: WIP: expression evaluation improvements

2021-11-05 Thread Andres Freund
Hi, On 2021-11-05 14:13:38 -0400, Robert Haas wrote: > On Fri, Nov 5, 2021 at 1:20 PM Andres Freund wrote: > > Yes. Optimally we'd do JIT caching across connections as well. One of the > > biggest issues with the costs of JITing is actually parallel query, where > > we'll often recreate the same

Re: WIP: expression evaluation improvements

2021-11-05 Thread Robert Haas
On Fri, Nov 5, 2021 at 1:20 PM Andres Freund wrote: > Yes. Optimally we'd do JIT caching across connections as well. One of the > biggest issues with the costs of JITing is actually parallel query, where > we'll often recreate the same JIT code again and again. For that you really > can't have

Re: WIP: expression evaluation improvements

2021-11-05 Thread Andres Freund
Hi, On 2021-11-05 09:48:16 -0700, Andres Freund wrote: > On 2021-11-05 08:34:26 -0400, Robert Haas wrote: > > I'm not sure why that requires all of this relative pointer stuff, > > honestly. Under that problem statement, we don't need everything to be > > one contiguous allocation. We just need

Re: WIP: expression evaluation improvements

2021-11-05 Thread Andres Freund
Hi, On 2021-11-05 13:09:10 -0400, Robert Haas wrote: > On Fri, Nov 5, 2021 at 12:48 PM Andres Freund wrote: > > I don't see how that works - the same expression can be evaluated multiple > > times at once, recursively. So you can't have things like > > FunctionCallInfoData > > shared. One key

Re: WIP: expression evaluation improvements

2021-11-05 Thread Robert Haas
On Fri, Nov 5, 2021 at 12:48 PM Andres Freund wrote: > I don't see how that works - the same expression can be evaluated multiple > times at once, recursively. So you can't have things like FunctionCallInfoData > shared. One key point of separating out the mutable data into something that > can

Re: WIP: expression evaluation improvements

2021-11-05 Thread Andres Freund
Hi, On 2021-11-05 08:34:26 -0400, Robert Haas wrote: > I'm not sure why that requires all of this relative pointer stuff, > honestly. Under that problem statement, we don't need everything to be > one contiguous allocation. We just need it to have the same lifespan > as the JITted code. If you

Re: WIP: expression evaluation improvements

2021-11-05 Thread Robert Haas
On Thu, Nov 4, 2021 at 7:47 PM Andres Freund wrote: > The immediate goal is to be able to generate JITed code/LLVM-IR that doesn't > contain any absolute pointer values. If the generated code doesn't change > regardless of any of the other contents of ExprEvalStep, we can still cache > the JIT

Re: WIP: expression evaluation improvements

2021-11-04 Thread Andres Freund
Hi, I pushed a rebased (ugh, that was painul) version of the patches to https://github.com/anarazel/postgres/tree/jit-relative-offsets Besides rebasing I dropped a few patches and did some *minor* cleanup. Besides that there's one substantial improvement, namely that I got rid of one more

Re: WIP: expression evaluation improvements

2021-11-04 Thread Robert Haas
Andres asked me off-list for comments on 0026, so here goes. As a general comment, I think the patches could really benefit from more meaningful commit messages and more comments on individual functions. It would definitely help me review, and it might help other people review, or modify the code

Re: WIP: expression evaluation improvements

2020-09-30 Thread Michael Paquier
On Wed, Jul 01, 2020 at 02:50:14PM +0200, Daniel Gustafsson wrote: > Since the CFBot patch tester isn't to apply and test a patchset divided across > multiple emails, can you please submit the full patchset for consideration > such > that we can get it to run in the CI? This thread seems to have

Re: WIP: expression evaluation improvements

2020-07-01 Thread Daniel Gustafsson
> On 3 Mar 2020, at 21:21, Soumyadeep Chakraborty > wrote: > Attached is a patch on top of > v2-0026-WIP-expression-eval-relative-pointer-suppport.patch that eliminates > the > const pointer references to fmgrInfo in the generated code. Since the CFBot patch tester isn't to apply and test a

Re: WIP: expression evaluation improvements

2020-03-03 Thread Soumyadeep Chakraborty
Hello Andres, Attached is a patch on top of v2-0026-WIP-expression-eval-relative-pointer-suppport.patch that eliminates the const pointer references to fmgrInfo in the generated code. FmgrInfos are now allocated like the FunctionCallInfos are (ExprBuilderAllocFunctionMgrInfo()) and are

Re: WIP: expression evaluation improvements

2020-02-19 Thread Soumyadeep Chakraborty
Hey Andres, > Awesome! +1. Attached 2nd version of patch rebased on master. > (v2-0001-Resolve-PL-handler-names-for-JITed-code-instead-o.patch) > > > > > Did you check whether there's any cases this fails in the tree with your > > patch applied? The way I usually do that is by running the

Re: WIP: expression evaluation improvements

2020-02-09 Thread Soumyadeep Chakraborty
Hi Andres, > Could you expand on what you mean here? Are you saying that you got > significantly better optimization results by doing function optimization > early on? That'd be surprising imo? Sorry for the ambiguity, I meant that I had observed differences in the sizes of the bitcode files

Re: WIP: expression evaluation improvements

2020-02-09 Thread Soumyadeep Chakraborty
Hi Andres, > I've comitted a (somewhat evolved) version of this patch. I think it > really improves the code! Awesome! Thanks for taking it forward! > I do wonder about adding a variadic wrapper like the one introduced here > more widely, seems like it could simplify a number of places. If we

Re: WIP: expression evaluation improvements

2020-02-06 Thread Andres Freund
Hi, On 2019-10-28 23:58:11 -0700, Soumyadeep Chakraborty wrote: > > Sorry for not replying to that earlier. I'm not quite sure it's > > actually worthwhile doing so - did you try to measure any memory / cpu > > savings? > > No problem, thanks for the reply! Unfortunately, I did not do anything

Re: WIP: expression evaluation improvements

2020-02-06 Thread Andres Freund
Hi, On 2019-10-28 23:58:11 -0700, Soumyadeep Chakraborty wrote: > > Cool! I'll probably merge that into my patch (with attribution of > > course). > > > > I wonder if it'd nicer to not have separate C variables for all of > > these, and instead look them up on-demand from the module loaded in > >

Re: WIP: expression evaluation improvements

2019-10-29 Thread Soumyadeep Chakraborty
Hi Andres, > I think I'd probably try to apply this to master independent of the > larger patchset, to avoid a large dependency. Awesome! +1. Attached 2nd version of patch rebased on master. (v2-0001-Resolve-PL-handler-names-for-JITed-code-instead-o.patch) > Did you check whether there's any

Re: WIP: expression evaluation improvements

2019-10-28 Thread Andres Freund
Hi, On 2019-10-27 23:46:22 -0700, Soumyadeep Chakraborty wrote: > Apologies, I realize my understanding of symbol resolution and the > referenced_functions mechanism wasn't correct. Thank you for your very > helpful > explanations. No worries! I was just wondering whether I was misunderstanding

Re: WIP: expression evaluation improvements

2019-10-28 Thread Soumyadeep Chakraborty
Hi Andres, Apologies, I realize my understanding of symbol resolution and the referenced_functions mechanism wasn't correct. Thank you for your very helpful explanations. > There's also a related edge-case where are unable to figure out a symbol > name in llvm_function_reference(), and then

Re: WIP: expression evaluation improvements

2019-10-24 Thread Andres Freund
Hi, On 2019-10-25 00:43:37 +0200, Andreas Karlsson wrote: > On 10/23/19 6:38 PM, Andres Freund wrote: > > In the attached *prototype* patch series there's a lot of incremental > > improvements (and some cleanups) (in time, not importance order): > > You may already know this but your patch set

Re: WIP: expression evaluation improvements

2019-10-24 Thread Andreas Karlsson
On 10/23/19 6:38 PM, Andres Freund wrote: In the attached *prototype* patch series there's a lot of incremental improvements (and some cleanups) (in time, not importance order): You may already know this but your patch set seems to require clang 9. I get the below compilation error which is

Re: WIP: expression evaluation improvements

2019-10-24 Thread Andres Freund
Hi, On 2019-10-24 14:59:21 -0700, Soumyadeep Chakraborty wrote: > After looking at > v2-0006-jit-Reference-functions-by-name-in-IOCOERCE-steps.patch, I was > wondering > about other places in the code where we have const pointers to functions > outside > LLVM's purview: specially EEOP_FUNCEXPR*

Re: WIP: expression evaluation improvements

2019-10-24 Thread Soumyadeep Chakraborty
Hey Andres, After looking at v2-0006-jit-Reference-functions-by-name-in-IOCOERCE-steps.patch, I was wondering about other places in the code where we have const pointers to functions outside LLVM's purview: specially EEOP_FUNCEXPR* for any function call expressions, EEOP_DISTINCT and EEOP_NULLIF