Born's WebGPU backend includes 53 embedded WGSL compute shaders covering 9 operator categories.
Element-wise Binary Operations (workgroup_size = 256)
| Shader | Expression | |--------|------------| | addShader | result[i] = a[i] + b[i] | | subShader | result[i] = a[i] - b[i] | | mulShader | result[i] = a[i] * b[i] | | divShader | result[i] = a[i] / b[i] |
Element-wise Unary Operations
| Shader | Expression | |--------|------------| | negShader | -a[i] | | expShader | exp(a[i]) | | logShader | log(a[i]) | | sqrtShader | sqrt(a[i]) | | reluShader | max(0.0, a[i]) | | sigmoidShader | 1.0 / (1.0 + exp(-a[i])) | | siluShader | a[i] / (1.0 + exp(-a[i])) |
Matrix Operations
| Shader | Workgroup | Description | |--------|-----------|-------------| | matmulShader | (16,16) | Standard matrix multiplication | | batchMatMulShader | (8,8,1) | Batched matrix multiplication |
Convolution and Pooling
| Shader | Workgroup | Description | |--------|-----------|-------------| | conv2dShader | (16,16) | 2D convolution | | maxPool2dShader | (16,16) | Max pooling |
Reduction Operations
| Shader | Description | |--------|-------------| | sumShader | Global sum | | globalSumShader | Cross-workgroup sum | | sumDimShader | Sum along an axis | | argmaxShader | Argmax along an axis |
Comparison and Logic
| Shader | Description | |--------|-------------| | greaterShader, lowerShader | >, < | | equalShader, notEqualShader | ==, != | | andShader, orShader, notShader | Logical operations |
Flash Attention
| Shader | Workgroup | Description | |--------|-----------|-------------| | flashAttentionShader | (8,8,1) | Tiled Flash Attention |
---
Total: 53 shaders
📘 *Born* is a serialized technical book. This is Appendix B, part 4.