Bend: a high-level language that runs on GPUs (via HVM2)
61–70 of 269 posts
Re: Bend: a high-level language that runs on GPUs (via HVM2)
#62> CPU, Apple M3 Max, 16 threads: 10.26 seconds
Surprised to see a more than linear speedup in CPU threads. What’s going on here?
Re: Bend: a high-level language that runs on GPUs (via HVM2)
#63I just wrote a simple loop in C++ to sum up 0 to 2^30. With a single thread without any optimizations it runs in 1.7s on my laptop -- matching Bend's performance on an RTX 4090! With -O3 it vectorizes the loop to run in less than 80ms.
#include
int main() {
int sum = 0;
for (int i = 0; i Re: Bend: a high-level language that runs on GPUs (via HVM2)
#64Question: Does this take into account memory bandwidth and caches between cores? Because getting them wrong can easily make parallel programs slower than sequential ones.
Re: Bend: a high-level language that runs on GPUs (via HVM2)
#65Very cool idea - but unless I'm missing something, this seems very slow. I just wrote a simple loop in C++ to sum up 0 to 2^30. With a single thread without any optimizations it runs in 1.7s on my laptop -- matching Bend's performance on an RTX 4090! With -O3 it vectorizes the loop to run in less than 80ms. #include int main() { int sum = 0; for (int i = 0; i
Re: Bend: a high-level language that runs on GPUs (via HVM2)
#66 def sum(depth, x):
if depth == 0:
return x
else:
fst = sum(depth-1, x*2+0) # adds the fst half
snd = sum(depth-1, x*2+1) # adds the snd half
return fst + snd
print(sum(30, 0))
under pypy3 it executes in 0m4.478s, single threaded. Under python 3.12, it executed in 1m42.148s, again single threaded. I mention that because you include benchmark information: CPU, Apple M3 Max, 1 thread: 3.5 minutes
CPU, Apple M3 Max, 16 threads: 10.26 seconds
GPU, NVIDIA RTX 4090, 32k threads: 1.88 seconds
The bend single-threaded version has been running for 42 minutes on my laptop, is consuming 6GB of memory, and still hasn't finished (12th Gen Intel(R) Core(TM) i7-1270P, Ubuntu 24.04). That seems to be an incredibly slow interpreter. Has this been tested or developed on anything other than Macs / aarch64?I appreciate this is early days, but it's hard to get excited about what seems to be incredibly slow performance from a really simple example you give. If the simple stuff is slow, what does that mean for the complicated stuff?
If I get a chance tonight, I'll re-run it with `-s` argument, see if I get anything helpful.
Re: Bend: a high-level language that runs on GPUs (via HVM2)
#67Re: Bend: a high-level language that runs on GPUs (via HVM2)
#68Very cool idea - but unless I'm missing something, this seems very slow. I just wrote a simple loop in C++ to sum up 0 to 2^30. With a single thread without any optimizations it runs in 1.7s on my laptop -- matching Bend's performance on an RTX 4090! With -O3 it vectorizes the loop to run in less than 80ms. #include int main() { int sum = 0; for (int i = 0; i
I think the point is that Bend in a much higher level than C++. But to be fair: I also may be missing the point!
q)\t sum til floor 2 xexp 30
1031Re: Bend: a high-level language that runs on GPUs (via HVM2)
#69As a resident of Bend, Oregon... it was kind of funny to read this and I'm curious about the origin of the name.
Re: Bend: a high-level language that runs on GPUs (via HVM2)
#70Tried to see what the language is like beyond hello world and found the guide[1]. It looks like a Python and quacks like a Haskell? For instance, variables are immutable, and tree-like divide and conquer data structures/algorithms are promoted for getting good results. That makes sense I guess! I’m not surprised to see a functional core, but I’m surprised to see the pythonic frontend, not that it matters much. I must say I highly doubt that it will make it much easier for Python devs to learn Bend though, although I don’t know if that’s the goal.
What are some challenges in programming with these kind of restrictions in practice? Also, is there good FFI options?
[1]: https://github.com/HigherOrderCO/bend/blob/main/GUIDE.md