Coder Social home page Coder Social logo

Comments (9)

regehr avatar regehr commented on June 3, 2024

aie!!! looks wrong. please tell us how to repro.

from souper.

fitzgen avatar fitzgen commented on June 3, 2024

I'll leave steps to repro to @jubitaneja since this was in a set of results that she synthesized, and I'm not 100% sure exactly what flags she used.

from souper.

jubitaneja avatar jubitaneja commented on June 3, 2024

I modified the enumerative synthesis and cache_infer script to run the synthesis experiment. Here is the branch that has the changes on the souper's side.
https://github.com/jubitaneja/souper/tree/cranelift

I took LHSes harvested from Nick's souper-harvester that is integrated in wasmtime/cranelift and just inferred the RHSes using modified cache_infer script.

from souper.

fitzgen avatar fitzgen commented on June 3, 2024

Looking through the results, it looks like this only happens when the LHS doesn't start at %0 or aren't contiguous (eg the LHS defines %0 and %3).

from souper.

jubitaneja avatar jubitaneja commented on June 3, 2024

@fitzgen you pointed out the right pattern. I tested this test case individually as well with master branch of souper and the issue can be reproduced.

$ cat s1.opt 
%3:i1 = var
%4:i32 = select %3, 2:i32, 1:i32
infer %4

$ souper-check -infer-rhs -souper-enumerative-synthesis-max-instructions=3 s1.opt 
; RHS inferred successfully
%2:i32 = zext %3
%3:i32 = add 1:i32, %2
result %3

I think there is some logic in writing RHSes with Lvalue numbering that counts the number of instructions on LHS and starts the count from there and hence, we are seeing the first instruction on RHS with lvalue label number as %2.

from souper.

regehr avatar regehr commented on June 3, 2024

ok, I'll explain how this works (hopefully correctly -- it's been a couple of years since I messed with this part of souper)

internally, these instruction numbers don't exist, they're purely an artifact of printing

when you print souper to text, there's a context object that keeps track of names. if you want the names to be consistent across a LHS and RHS, you have to use the same context object.

now in the message above, we're seeing two different tool executions -- so they're clearly not sharing a context object. so there's no reason to expect consistent numbering.

I could easily be missing something, just taking a quick look here. but Jubi, if you want to show us a souper bug, you have to show the LHS and RHS being printed together, incorrectly. if you're printing them separately, you shouldn't expect any name consistency.

from souper.

manasij7479 avatar manasij7479 commented on June 3, 2024

We should probably change souper-check so that the whole replacement is printed after enumerative synthesis, not just the RHS.

from souper.

regehr avatar regehr commented on June 3, 2024

We should probably change souper-check so that the whole replacement is printed after enumerative synthesis, not just the RHS.

pretty sure there's a command line argument for doing exactly that

from souper.

jubitaneja avatar jubitaneja commented on June 3, 2024

@zhengyang92 pointed out the option to print the entire replacement after the synthesis is done instead of writing the RHSes only. I tested with -print-replacement-split and it worked fine for this test case. So, for the testing we can add this option to cache_infer script.

$ cat s1.opt
%3:i1 = var
%4:i32 = select %3, 2:i32, 1:i32
infer %4

$ souper-check -infer-rhs -print-replacement-split -souper-enumerative-synthesis-max-instructions=3 s1.opt 
; RHS inferred successfully
%0:i1 = var
%1:i32 = select %0, 2:i32, 1:i32
infer %1
%2:i32 = zext %0
%3:i32 = add 1:i32, %2
result %3

from souper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.