stng icon indicating copy to clipboard operation
stng copied to clipboard

Can't create Z3 or halide code from .sk.out

Open sdorkenw opened this issue 8 years ago • 4 comments

I created the simple_loop01.ir, simple_loop01.sk and simple_loop.sk.out as shown in the end-to-end example and they look fine as far as I can tell. Creating the Z3 file and the halide code fails however, both with very similar errors (from the point on where pp.SketchResultProcessor(...).interpret() is called):

[INFO]: Generating backend code from IR file: simple_out/simple_loop0.ir
[INFO]: and sketch output file: sketch/simple_loop0.sk.out
[INFO]: to output file: simple_out/simple_loop0_halide.cpp
Traceback (most recent call last):
File "./stng-backend.py", line 147, in <module>
 gen_backend_code(args)
File "./stng-backend.py", line 82, in gen_backend_code
 postcondition = pp.SketchResultProcessor(skresult.read()).interpret()
File "/home/sdorkenw/stng/backend/process_sketch_results.py", line 235, in interpret
 self.process_generated_func(match.group(1), lineno)
File "/home/sdorkenw/stng/backend/process_sketch_results.py", line 92, in process_generated_func
 self.generated_funcs[name.strip()] = self.interpret_generated_func(self.sketch_result[start_lineno:end_lineno])
File "/home/sdorkenw/stng/backend/process_sketch_results.py", line 177, in interpret_generated_func
 out = sympy.sympify(out)
File "/usr/local/lib/python2.7/dist-packages/sympy/core/sympify.py", line 324, in sympify
 raise SympifyError('could not parse %r' % a, exc)
sympy.core.sympify.SympifyError: Sympify of expression 'could not parse u'in(_out_s21-99)'' failed, because of exception being raised:
SyntaxError: invalid syntax (<string>, line 1)

sdorkenw avatar Nov 24 '16 22:11 sdorkenw

Sympy apparently no longer likes variables named in. Fix for this incoming shortly.

shoaibkamil avatar Dec 06 '16 18:12 shoaibkamil

@sdorkenw Please let me know if this isn't now fixed as of baf40a7.

shoaibkamil avatar Dec 06 '16 19:12 shoaibkamil

@shoaibkamil would it be easier to stick with an older version of sympy?

akcheung avatar Dec 06 '16 20:12 akcheung

@akcheung It looks like this has been an issue for a while, but I'd used input as my input array.

shoaibkamil avatar Dec 06 '16 20:12 shoaibkamil