-
Notifications
You must be signed in to change notification settings - Fork 53
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
Tight packing on hardware for DataPack #44
Conversation
Thinking about this a bit more, maybe the reason why it wasn't tightly packed even on hardware was so that it can easily be used for memory access from external DDR? |
Hey! I think your solution with the width calculator helper class is the right approach. Did you experience that it does not work in simulation? I can't immediately see why it shouldn't. The Could you add some tests that use |
I have tried a pure software run and a hardware build, both were successful. |
Thinking about it a little more, the I have taken the liberty to update catch so that i can use Now I am running some trouble. I get segfaults on all tests that use non-const |
Some further checking shows that this may be down to faulty type resolution. I have found a (somewhat ugly) workaround for this in the last commit. |
So exactly as you were guessing, the As far as I can tell, everything is working now: Tests are passing in the library, and the code produced is correct for my application case. |
My PhD dissertation is due on Wednesday, so I might respond a bit slowly over the next week :-) Again, I like your solution with specializing the bit reinterpretation -- well done. I did a first review and had some comments. |
Ok I think I've fixed all the issues, thanks for your feedback! So you're almost done with your PhD work, awesome! |
Actually there may still be issues with the PR on hardware, my code seems to produce wrong results. Hope your Thesis submission went well, I hope you can take some time off and enjoy the outdoors before autumn starts! |
Hey, I'm out on the other side now :-) Ok -- let me know when you're confident that it works! |
We should also have a test that runs this through HLS! |
I can see that in normal C++ code passing by reference would be preferable, but I have been wondering for a while how stuff like that translates to hardware. I have quite a lot on my plate right now, so if possible I would like some help with the HLS tests! |
It will make literally no difference in hardware, and in most cases not in software either (any data type of a size <= to a pointer will not be more expensive to copy than the pointer). It's mostly a convention thing :-)
Ok, we can merge it into a branch |
Could you remove the update of |
Sure! |
There's nothing wrong with the existing tests, I just want to add tests in synthesis also |
I only updated the version because types tests were not available in 1.x. the catch macro I use for the typed tests was introduced in 2.x, so reverting to the original version means I either need to delete the tests or copy the entire code (or slide some other trick maybe?) to implement it for other types. |
I already updated master, so just merge/rebase and you should have the newest release of catch |
More template magic could make this nicer.
Function resolution seems to not work as intended for some reason...
Co-authored-by: definelicht <johannes@musicmedia.dk>
Co-authored-by: definelicht <johannes@musicmedia.dk>
Sorry it took me so long, this branch is now rebased onto master! |
This pull request attempts to solve #43 by implementing tight packing for the DataPack class.
Mainly this is done through a small proxy template class that can easily be specialized for any datatype who's bit width is not a multiple of 8.
I also added a few sample specializations for the
ap_uint
and theap_fixed
types, but they are not ideal yet by any means.One problem that this may introduce is that the code will not be equivalent between CPU and FPGA, and thus testing is difficult (impossible?) without actually running tests on an FPGA.