luc-tielen / eclair-lang

A minimal, fast Datalog implementation in Haskell that compiles to LLVM IR
BSD 3-Clause "New" or "Revised" License
220 stars 12 forks source link

invalid redefinition of function 'eclair_btree_insert_range_delta_*' #164

Open Price1999a opened 8 months ago

Price1999a commented 8 months ago
@def p(X: u32, Z: u32) input output.
@def q(X: u32, Y: u32, Z: u32) input output.
@def r(R: u32, P: u32, E: u32) input.
@def c(Y: u32, Z: u32, W: u32) input.
@def u(R: u32, Z: u32, W: u32) input.
@def s(R: u32, P: u32) input.

p(arg_x,arg_z) :- p(arg_x,arg_y), p(arg_y,arg_z).
q(arg_x,arg_r,arg_z) :- p(arg_x,arg_y), q(arg_y,arg_r,arg_z).
p(arg_x,arg_z) :- p(arg_y,arg_w), u(arg_w,arg_r,arg_z), q(arg_x,arg_r,arg_y).
p(arg_x,arg_z) :- c(arg_y,arg_w,arg_z),p(arg_x,arg_w), p(arg_x,arg_y).
q(arg_x,arg_q,arg_z) :- q(arg_x,arg_r,arg_z),s(arg_r,arg_q).
q(arg_x,arg_e,arg_o) :- q(arg_x,arg_y,arg_z),r(arg_y,arg_u,arg_e),q(arg_z,arg_u,arg_o).

Hello, this is an Eclair rewrite of the Soufflé rules in galen. However, after compiling it to an LLVM IR file using the current version of Eclair, I found that there are errors in the generated code. The compiler seems to generate a series of duplicate functions. For example, L5016 and L5032.

I used the following compilation command (shentianqi/eclair comes from mygithub action ):

docker run -v $(pwd):/code --rm -it shentianqi/eclair:main eclair compile /code/query-eclair.dl >$(pwd)/query-eclair.ll
FROM teeks99/clang-ubuntu:17

WORKDIR /app
VOLUME /app/data

COPY main.c .
COPY query-eclair.ll .

RUN clang -o program main.c query-eclair.ll

CMD ["./program"]
luc-tielen commented 8 months ago

Hey, thanks for reporting this bug! I'm curious what you want to use Eclair for, or is this just a simple benchmark for now?

This has to do with parts of the codegen not properly being cached.

Unfortunately lately I have been extremely busy irl and I haven't had the chance to pick back up the work on Eclair. It's also going to stay this way for the foreseeable future so idk when I can get back to it at this time.

Price1999a commented 8 months ago

Thanks for the swift response! I'm just running some simple performance benchmarks on Eclair at the moment. No rush on the updates—I understand how busy life can get.

luc-tielen commented 8 months ago

Ok, interesting. Curious to hear the results! Keep in mind I've mainly been focusing on getting it working / correctness, there's only a small basic set of optimizations so far..