Ups, downs, and rage
I've been cranking away all weekend on getting a proper GPGPU demo put together; nothing fancy, just sums two large buffers of floating point numbers.
The first big hurdle was moving data up to the GPU efficiently; I'm not entirely happy with my current solution, as it involves a couple of extra copy operations, but I'll live with that for now.
The next problem was building the actual data buffers. There was an array feature already in the language, so I decided to hijack it and use that to work the data around.
This was a mistake.
Arrays in Epoch were formerly implemented as entirely stack-allocated entities. This means that it isn't really very easy to move a large data buffer around, because you have to do a lot of copies to and from the stack. I blew several hours of this afternoon trying to make it work, and finally gave up in frustration (I have a rule that after about the 50th time I yell "FUCK" across the office, I need to quit).
Long story short, I've ripped out every last bit of the array code, and I'm now going to go work on reimplementing array support using the freestore. I already have a mechanism doing this with character (byte) buffers, so it should go quickly.
I will update as things happen; for now, I need to wait for this red haze in my vision to clear up, and then get hacking on the new array implementation.
Time to GDC is ticking away painfully fast, and I've still got a long way to go on this beast before R9 is ready to go. And to think I almost gave up caffeine a while ago...
Progress on the array rewrite is slow but steady. I'm starting to make fuzzy-brain mistakes, which is a bad sign, as it means I'll hit the threshold of non-productivity soon, where I spend more time cleaning up my own dumb mess than I do making forward progress.
Convoluted run-on sentences are also a symptom of loss of higher brain functions.
I am doomed.
Sadly, I'm stupid enough to stay awake until I get this thing ready, because I absolutely have to have R9 set for GDC or I will hate myself forever. My week is going to be twelve kinds of crazy even without the pressure of getting Epoch work done, so expect to watch my sanity slowly erode.
I may or may not attack random passerby with a lawn chair; I must consult the Cheeseburger God to determine the most luminous path for my life's forward journey.
All hail the hypnotoad.
Finally got arrays reimplemented and passing all of the unit tests; this means the only thing left to do is get the GPU data marshaling stuff retooled to use the new array design. Once that's out of the way, I'll officially be back to where I started this morning. Yayy!
If I'm lucky, the GPU data copying bit will be easy, and I can work on a couple of the other goodies I want to cram into R9 - specifically, automatically vectorized for() loops.
Yes, that's right, automatic vectorization. The system should be smart enough to use a massive number of GPU threads if available, or one thread per CPU core if a suitable GPU can't be located. This gives Epoch the unique ability to run your code on the fastest available hardware for the given task type - precisely what I wanted when I set out to create the language.
So, all in all, I'm half happy, half exhausted, and a bit annoyed at the day's setbacks, all at once.
More caffeine time!