Ziyi’s Status Report – 04/10/22

This week we got a ton done on the hardware side of things. First of all, after finally squeezing out the final few compilation errors, we managed to get a trimmed down version of the kernel (everything sans nearest neighbor loops) built using Vitis HLS synthesis. After looking at the synthesis analysis, we were able to see that the correct loops were also getting synthesized, which meant that our code was being inferred correctly.

After passing synthesis, we were able to export the rtl implementation (the .xo file) and import it into regular Vitis itself without any additional troubles. Then, after implementing some basic interfacing code between the host program and the kernel, were were able to build a binary to run on the FPGA. In order to get this binary onto the board, we simply scp’d the files onto the board.

Running the program resulted in a segmentation fault, so we still have a bit to go. My goal for next week is to debug the interface and work on some optimizations with Alice and Jeremy.

Team Status Report for 04/02/2022

This week’s focus was entirely on getting the Vitis HLS build to work. We made really great progress with converting all the floating point numbers and operations to fixed point ones, stripping the code even further of unnecessary functions, and converting all the math operations from std to hls ones.

We’ve managed to get almost everything working, except for random number generation when making the particles. The goal for the rest of today and tomorrow is to get the Vitis HLS build completely working (which is a must for the interim demo) and have some way of sending the output from the FPGA code to the host computer, which can then render and evaluate the fluid against the baseline CPU version.

New Schedule:

Ziyi’s Status Report – 04/02/22

This week we got a lot of work done in terms of synthesizing the kernel. At the start of the week, we managed to get a synth running using floats as the main datatype. The problem with this one is that since floats were so computationally intensive, it was pretty much impossible to get the critical path to converge to the target critical path, and so we couldn’t meet timing. Nevertheless, this was a significant step in the right direction.

So my next task was to begin the migration from floats into our custom fixed point datatype. Basically any calculation we would perform on the particle positions or speeds, we would replace with a fixed point datatype. For now, we decided to use a fixed point representation where we have 6 bits representing the integral part of the number and 6 bits representing the fractional part of the number.

Unfortunately, this would prove to be quite an involved task, as we would also need to make significant changes to all of the math libraries in order to change them to use the new datatype. So, a majority of this week was spent incrementally compiling and changing the math libraries to use the arbitrary precision datatype instead of the floats. This was complicated by the fact that there were still some weird C++ issues that led to some weird aliasing of the datatype to the int datatype. Another specific issue we had to investigate was how we would take care of some specific math functions (such as square root); thankfully, this issue was easily addressed using the equivalents in the HLS math library. Other than that, we seem to have mostly figured out those issues, and now we have a compile running!

Build almost there! Still some kinks in our kernel to figure out

Our next step is to finalize the changes to get a complete synth of the kernel and then upload the project to normal Vitis so we can generate a binary file and upload it onto the board in time for the in-class demo. All in all, I am much more optimistic as to the effectiveness of our project after this week.

Jeremy’s Status Report – 04/02/2022

This week we did a lot of work on both some optimizations and synthesizability of our project. There were still many C++ errors from the interactions with the Vitis libraries and the modern C++ codebase that we are using. After initial synthesis attempts, it turned out the amount of floats, there was no way we could meet any sort of reasonable clock period for synthesis, so we began converting the code to use fixed point numbers as outlined in our design. But, the libraries provided by Vitis did not interact well with the already written math libraries, and I spent a while trying to get these libraries to cooperate with each other.

I think that we are on time, and are making steady progress towards the goals we set out to accomplish. We need to ensure that we work consistently in the upcoming weeks, but we have been working well recently. Next week I hope to work more on optimizations with unrolling and pipelining.

Alice’s Status Report for 04/02/2022

In my last update, the main goal I wanted to tackle was getting the evaluation script to work with the fluid simulation output. Unfortunately, I was not able to accomplish this as all of my time for this week was spent on working with Ziyi and Jeremy to get the Vitis HLS build working.

We’ve been in the lab nearly every day, and thankfully we are really close to being done. We just have some issues with random number generation for the initial positions of the particles, and dealing with some last minute replacements of std math functions with hls functions.

The demo is Monday, and while we are in an OK spot I am still a bit worried about it. I’m staying up all night today to aim to get it working by tonight in case we run into new issues tomorrow.

Team’s Status Report for 03/26/2022

This week, we made progress on two fronts. On the hardware front, Jeremy and Ziyi worked on getting the Vitis HLS build to work on the stripped down version of Scotty3D; on the software front, Alice worked on having Scotty3D read particle postions from a preloaded file for stepping through a simulation.

In terms of hardware, we managed to get the C simulation build option to work and run a small testbench. While this was a good start for getting the binary built, we realized that we still had a long way to go before we could get C synthesis to work. The biggest hurdle is that the C synthesis seems to run on an older version of C++, with a bunch more restrictions and caveats on what can actually get compiled into hardware. Many features that the C simulator readily worked with, the C synthesis just outright refused to cooperate with. Still, despite these setbacks, we believe that we are quite close to a breakthrough for the C synthesis. Once we finally get a working build, we will get the area estimates and also get some timing reports from putting the binary on the Ultra96 development board and running it. It is also worth noting that in our endeavors to get a working build, we  alsorefactored the par_for, seq_for, and for_n (for neighbors) lambda functions into separate, discrete for loops. Though this reduces code reuse, it is important in that it allows us to specifically reconfigure the different instances of these loops so that we can more deliberately assign hardware resources as opposed to accelerating all of the different loops with the same parameters (which would otherwise be hard coded in the lambda functions themselves).

In terms of the Scotty3D interface, we were successful in getting Scotty3D to run a precomputed set of points. Of course, this resulted in a lightning fast visual simulation within the Scotty3D engine, which provides a compelling example of the benefit of hardware accelerated precomputation. Nevertheless, though this is not as interesting as a real-time demo, it is a significant step in the right direction. The next major goal on the interface side is to enable UART communications between the FPGA and a host computer to transfer live simulation data. This will be an essential step to having  the real-time simulation. Of course, we will also have to investigate the UART bandwidth to see if we can keep up with frames per second latency demands of the simulator.

Jeremy’s Status Report for 03/26/2022

This week I was primarily working with Ziyi on getting the code in the C++ build environment to work well with the Vitis HLS build. We spent a while improving the portability of the code as Vitis has a set of specific requirements, and does not work well with very modern C++ code that is generic for many purposes. Vitis HLS has very cryptic error messages, so progress is steady but slow on getting this to work. There is a lot of trial and error involved in figuring out what is causing errors, and it is tricky to figure out how to redesign the code to fix it. We also began to work on optimizations for the fluid simulation, initially by starting to unroll loops, which creates larger parallelism and hardware utilization.

I think that we are on track to complete our project on time, but slightly behind where I would like to be at this point. It is good that we left ample slack in our schedule. Next week I want to continue to work on optimizing the implementation, and also work with Alice on communication between the FPGA and CPU to display the output of our renders.

Ziyi’s Status Report for 03/26/2022

At the start of this week, Jeremy and I managed to get the C simulation build to pass in Vitis HLS. While we were quite happy at this initial success, we quickly realized that we still needed a lot more work to get the C synthesis working. One thing that majorly complicated this task was that the C synthesis build script would fail pre-synthesis without actually printing any errors. However, after poking around on the Vitis forums and ticking some specific compilation boxes, we could finally read some of the error logs. As it turns out, most of our problems were just version and build conflicts with different C++ features. For instance, while we were able to get away with the auto function type for our lambda functions in simulation, the synthesis compiler got a bit angry at us. Right now, we are still trying to resolve these issues and hopefully synthesize some version of the kernel soon.

In the process of fixing these compilation errors, we also got started on our optimization work. One major task that we did this week was that we got rid of all instances of par_for, seq_for, and for_n, which – respectively – iterated a function over the particles parallelly, iterated over the particles sequentially, and iterated over the neighbors of each particle. This is a major step, as it allows us to manually control the unroll parameters of the kernel on a per-loop basis, rather than applying a single pragma en masse.

Other than slowly grinding through the myriad waves of compilation errors, there is nothing too much to schedule and to report. Still, once we get a working build of the binary, we’ll throw it onto the FPGA and get some timing values reported. We’ll also need to get a survey of the resource utilization of the base implementation. We envision that this will be done by next week.

Ziyi’s Status Report for 03/19/2022

Most of my effort this week was spent on getting a lightened version of the fluid simulation kernel to build on Vitis HLS. This comes as a transition in our priorities to better make an MVP target for our project. Specifically, we were interested in implementing a “headless” version of the simulation kernel, where the only thing that we would specifically need to run is the step2 function in the fluid simulation kernel. We decided that all of the rest of the rendering tasks are not as pressing and should thus be handled at a later point.

Much of the work of this week was setting up the Vitis HLS project on the ECE number machines. We were running into some significant build issues running on Alice’s computer, and the documentation online was frustratingly sparse. As such, in order to make some breakthroughs in our project, we decided to transition to the existing, working, setup that 643 uses. Setting up the project took a bit of work, but we were eventually able to resolve a lot of the bulid issues and get the C simulation task to build. A large part of this task was refactoring parts of the code to remove C++17 artefacts and using different versions of the different libraries that the Scotty3D library depends on.

Right now, we are still trying to figure out how to get the C synthesis to fully build. It is a bit difficult at the moment, as the synthesis log is not actually highlighting the error. However, I think it might have something to do with the tool inferring multiple TOP functions.

Obviously, the goal for next week is to get a working version of C synthesis running.

Team Status Report for 03/19/2022

At the moment, the most jeopardizing issue we have is figuring out how to integrate everything into one package on the board including a display output. As our efforts have been focused on building and accelerating the fluid simulator, we are still unsure about display. We have a variety of backup plans for this issue issue, such as producing a file of the rendered output, and producing the display from somewhere else. This still aligns with our project goals as we are not aiming for a real-time system, and are just trying to accelerate the fluid simulation process.

We decided to make a system change, such that the FPGA platform will only perform the fluid simulation algorithm. In other words, it will take an array of 3D positions and output an array of 3D positions for each frame, and save that to a file such that a host computer that is able to run Scotty3D can load in the simulation file and play the fluid simulation. This system change plays into the category of “request scheduler”, which is shown below.

Jeremy and Alice also swapped responsibilities since Jeremy is more experienced at C++ and digital hardware, and Alice’s knowledge of the Scotty3D codebase is helpful for adding additional features necessary to load the simulation into Scotty3D and getting the FPGA to send over the necessary data to the host computer. Below is the updated Gantt Chart: