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

SeeDot: ProtoNN X86 generated code (32-bit) gives segmentation fault #129

Closed
eirikvaa opened this issue Sep 13, 2019 · 5 comments
Closed

Comments

@eirikvaa
Copy link

eirikvaa commented Sep 13, 2019

I'm working on using the X86 backend instead of the Arduino backend for the SeeDot compiler. Edit: Here I'm using ProtoNN. I'm able to generate C++ code, but I get a segmentation fault on the following line in seedot_fixed.cpp:

SparseMatMul(&Zidx[0], &Zval[0], X, &tmp6[0][0], 257, 128, 128, 2);

If I instead use 256, such that the line then becomes

SparseMatMul(&Zidx[0], &Zval[0], X, &tmp6[0][0], 256, 128, 128, 2);

then it works.

If we then assume that I have generated an executable called main and run this with the following command

./main protonn fixed training

then I get the following output

#test points = 2007
Correct predictions = 352
Accuracy = 17.539

although, at the end of the training, I'm presented with the following output

Execution...success
Accuracy is 89.537%

Edit: If I use Bonsai instead of ProtoNN, I get an accuracy of 26,5% (instead of 17,5% like above). And the segmentation fault is gone.

Some questions:

  • What is the reason for the segmentation fault?
  • How come the accuracy is low (the first I mentioned), and not equal to the second I mentioned?
  • I might have made some mistakes on the road to generating X86 and would be very glad for any directions to how to do his correctly. I had to make several changes to SeeDot.py and main.py in the seedot directory, as it was quite hardcoded for the Arduino platform.
@eirikvaa eirikvaa changed the title SeeDot: X86 generated code (32-bit) gives segmentation fault SeeDot: ProtoNN X86 generated code (32-bit) gives segmentation fault Sep 16, 2019
@sridhargopinath
Copy link
Contributor

Hi @eirikvaa,

Thank you for your interest in SeeDot.

Could you please provide the exact command line used to generate code so that I can reproduce the error at my end? Also, did the errors occur after you modified SeeDot.py and main.py, or with the unmodified code?

Thanks,
Sridhar

@eirikvaa
Copy link
Author

eirikvaa commented Sep 17, 2019

Could you please provide the exact command line used to generate code so that I can reproduce the error at my end?

For the ProtoNN implementation I have used exactly the same command line arguments as in the tutorial provided.

Also, did the errors occur after you modified SeeDot.py and main.py, or with the unmodified code?

The error did indeed occur after I had modified SeeDot.py and main.py.

  • Diff of main.py vs main86.py
  • Diff of SeeDot.py vs SeeDot86.py

I am sure that I have introduced some error along the way, but not sure where. I hope the diff of the two pairs of files are helpful. I can also provide bigger parts of the project if necessary.

@sridhargopinath
Copy link
Contributor

It is hard for me to go through the diff to figure out the error. I have another suggestion. After SeeDot explores multiple programs, it will generate x86 code for the testing set in a temporary directory and executes that to obtain the accuracy of the fixed-point code. You can find this code in TEMPDIR/seedot_fixed.cpp. You can modify this code accordingly.

@eirikvaa
Copy link
Author

I can understand that. Ok, I will try that and report back, thank you very much for helping me out.

@eirikvaa
Copy link
Author

Everything works! I think it just boils down to copying the wrong set of files into the output directory. Thank you very much for your help.

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

No branches or pull requests

2 participants