tensor_gelu.bend

stelliferous@0.0.3.0 · 12 lines · 0 definitions

1# The compensated GELU mapper, with one scalar tail and two eight-lane stages.
2import Base
3import stelliferous@0.0.3.0/math_gelu_lanes.bend as Gelu
4import stelliferous@0.0.3.0/traversal_lanes.bend as Lanes
5import stelliferous@0.0.3.0/storage_buffer.bend as Storage
6import stelliferous@0.0.3.0/proofs/storage_certificate.bend as Certificate
7import stelliferous@0.0.3.0/proofs/math_gelu_lanes_certificate.bend as GeluCertificate
8
9def mapped(+count: Nat,+position: U32,buffer: Storage.Buffer<F32>) -> Storage.Buffer<F32>:
10  Storage.Buffer{values,length,Certificate.Certificate{+depth,equation}} = buffer
11  Storage.Buffer{Gelu.map_when(Lanes.covered(depth,position,count),count,position,values),length,
12    GeluCertificate.map_when(Lanes.covered(depth,position,count),count,position,values,Certificate.Certificate{depth,equation})}