Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yosys-optimizer: segfault when using abc-mode=True and mode=Boolean #554

Closed
asraa opened this issue Mar 26, 2024 · 3 comments · Fixed by #568
Closed

yosys-optimizer: segfault when using abc-mode=True and mode=Boolean #554

asraa opened this issue Mar 26, 2024 · 3 comments · Fixed by #568

Comments

@asraa
Copy link
Collaborator

asraa commented Mar 26, 2024

Just came across this problem.

It seems like there's some issue with using the -fast flag in the yosys script.

I've tried to run the yosys process by itself, and things are fine when I run the same command in a Yosys process. So I'm not sure how to go about debugging this issue...

@asraa
Copy link
Collaborator Author

asraa commented Mar 26, 2024

The ABC script that aborts:

echo + read_blif "/tmp/yosys-abc-MiFyiU/input.blif";
read_blif "/tmp/yosys-abc-MiFyiU/input.blif";
echo + read_lib  -w "/google/obj/workspace/14af16fc455a3717b1d6194c74be2f5443f6068885d24f71bfc44be057885388/ef4582f9-a7e0-4685-9b02-a9246f3ae45b/blaze-out/k8-dbg/bin/third_party/heir/tools/heir-opt.runfiles/google3/third_party/heir/lib/Transforms/YosysOptimizer/yosys/tfhe-rs_cells.liberty" ;
read_lib  -w "/google/obj/workspace/14af16fc455a3717b1d6194c74be2f5443f6068885d24f71bfc44be057885388/ef4582f9-a7e0-4685-9b02-a9246f3ae45b/blaze-out/k8-dbg/bin/third_party/heir/tools/heir-opt.runfiles/google3/third_party/heir/lib/Transforms/YosysOptimizer/yosys/tfhe-rs_cells.liberty" ;
echo + strash;
strash;
echo + dretime;
dretime;
echo + map ;
map ;
echo + write_blif /tmp/yosys-abc-MiFyiU/output.blif;
write_blif /tmp/yosys-abc-MiFyiU/output.blif

Without fast mode, we succeed with the following script

echo + read_blif "/tmp/yosys-abc-x9gvxO/input.blif";
read_blif "/tmp/yosys-abc-x9gvxO/input.blif";
echo + read_lib  -w "/google/obj/workspace/14af16fc455a3717b1d6194c74be2f5443f6068885d24f71bfc44be057885388/ef4582f9-a7e0-4685-9b02-a9246f3ae45b/blaze-out/k8-dbg/bin/third_party/heir/tools/heir-opt.runfiles/google3/third_party/heir/lib/Transforms/YosysOptimizer/yosys/tfhe-rs_cells.liberty" ;
read_lib  -w "/google/obj/workspace/14af16fc455a3717b1d6194c74be2f5443f6068885d24f71bfc44be057885388/ef4582f9-a7e0-4685-9b02-a9246f3ae45b/blaze-out/k8-dbg/bin/third_party/heir/tools/heir-opt.runfiles/google3/third_party/heir/lib/Transforms/YosysOptimizer/yosys/tfhe-rs_cells.liberty" ;
echo + strash;
strash;
echo + &get -n;
&get -n;
echo + &fraig -x;
&fraig -x;
echo + &put;
&put;
echo + scorr;
scorr;
echo + dc2;
dc2;
echo + dretime;
dretime;
echo + strash;
strash;
echo + &get -n;
&get -n;
echo + &dch -f;
&dch -f;
echo + &nf ;
&nf ;
echo + &put;
&put;
echo + write_blif /tmp/yosys-abc-x9gvxO/output.blif;
write_blif /tmp/yosys-abc-x9gvxO/output.blif

Without the custom liberty file, we succeed with this script:

echo + read_blif "/tmp/yosys-abc-Xzg1T0/input.blif";
read_blif "/tmp/yosys-abc-Xzg1T0/input.blif";
echo + read_library /tmp/yosys-abc-Xzg1T0/stdcells.genlib;
read_library /tmp/yosys-abc-Xzg1T0/stdcells.genlib;
echo + strash;
strash;
echo + dretime;
dretime;
echo + map;
map;
echo + write_blif /tmp/yosys-abc-Xzg1T0/output.blif;
write_blif /tmp/yosys-abc-Xzg1T0/output.blif

Copy link

This issue has 1 outstanding TODOs:

This comment was autogenerated by todo-backlinks

@asraa
Copy link
Collaborator Author

asraa commented Mar 27, 2024

Got a little closer: I'm hitting an assertion failure in ABC. I'm going to ask an expert

copybara-service bot pushed a commit that referenced this issue Mar 27, 2024
Fixes #554

It appears that our custom liberty file was not providing delays for the cells, and that was causing an assertion failure in the ABC library. Since the tfhe-rs boolean gates are a subset of the standard cell library, just restrict the standard cells using `-g CELLTYPE, ...` flags.

PiperOrigin-RevId: 619611385
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant