Source/Packages

Runtime.NativePointwisePlan

packages/execution/src/Runtime/NativePointwisePlan.alpha

436 lines23 declarations18.6 KiBSHA-256 fd2fbc317365

def · lines 176–228

nativePointwiseUnary

Full file
Binary64 under the native finite profile (Runtime.NativeFloatPlan): negation flips the sign bit; square, reciprocal (1 / x) and square root are single correctly rounded operations; any nonfinite operand or result refuses. A reciprocal square root would be two roundings here, unlike the device profiles' single approximate operation, so it is not admitted.
176def nativePointwiseUnary =
177  (lambda unrestricted scratch : Nat .
178    (lambda unrestricted operation : (family PointwiseUnary) .
179      (lambda unrestricted destination : Nat .
180        (lambda unrestricted source : Nat .
181          (lambda unrestricted tail : (family NativePhysicalCommands) .
182            (eliminate
183              PointwiseUnary
184              (lambda unrestricted current : (family PointwiseUnary) .
185                (family NativePhysicalCommands))
186              operation
187              (branch PointwiseNegate . (nativePointwiseNegate scratch destination source tail))
188              (branch
189                PointwiseSquare
190                .
191                (nativeFiniteFloat64Binary
192                  b"pointwise-nonfinite"
193                  scratch
194                  (constructor NativePhysicalFloat64Operation NativePhysicalFloat64Multiply)
195                  destination
196                  source
197                  source
198                  tail))
199              (branch PointwiseRoundBF16 . tail)
200              (branch
201                PointwiseReciprocal
202                .
203                (nativeMemoryStoreWord64
204                  b"pointwise-one"
205                  destination
206                  (nativeLaunchRecipeImmediate nativePointwiseOneBits)
207                  (nativeFiniteFloat64Binary
208                    b"pointwise-nonfinite"
209                    scratch
210                    (constructor NativePhysicalFloat64Operation NativePhysicalFloat64Divide)
211                    destination
212                    destination
213                    source
214                    tail)))
215              (branch PointwiseReciprocalSquareRoot . tail)
216              (branch
217                PointwiseSquareRoot
218                .
219                (nativeFiniteFloat64Binary
220                  b"pointwise-nonfinite"
221                  scratch
222                  (constructor NativePhysicalFloat64Operation NativePhysicalFloat64SquareRoot)
223                  destination
224                  source
225                  source
226                  tail))
227              (branch PointwiseTanh . tail)
228              (branch PointwiseExponentialBase2 . tail)))))))

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.