←back to thread

170 points judicious | 6 comments | | HN request time: 0.299s | source | bottom
1. Legend2440 ◴[] No.45406467[source]
Article doesn’t mention this, but I’d consider neural networks a form of branchless programming. It’s all a bunch of multiply and threshold operations.
replies(2): >>45406503 #>>45407289 #
2. abyesilyurt ◴[] No.45406503[source]
Thresholding requires branching no?
replies(3): >>45406688 #>>45406694 #>>45407482 #
3. WJW ◴[] No.45406688[source]
No, you can do that without branching. See https://en.algorithmica.org/hpc/pipelining/branchless/#predi... for example.
4. Legend2440 ◴[] No.45406694[source]
No, it’s just a math operation and can be applied to any amount of data in parallel.
5. david-gpu ◴[] No.45407289[source]
> It’s all a bunch of multiply and threshold operations.

Real-world high-performance matrix multiplication functions do contain branches internally, even on GPUs. If you are ever curious about what that looks like, NVidia maintains an open-source library called CUTLASS.

6. bqmjjx0kac ◴[] No.45407482[source]
As demonstrated in the article, you can compute clamp(x, min, max) with straight-line code.