Source/Packages

Runtime.NativeDataParallelOwned

packages/execution/src/Runtime/NativeDataParallelOwned.alpha

2,874 lines126 declarations142.2 KiBSHA-256 de18258423c4

def · lines 733–789

dpoProject

Full file
Every reduction's leaf: this owner's numerators of that owner's coordinates (+0 past k), then its mass.
733def dpoProject =
734  (lambda unrestricted c : Nat .
735    (lambda unrestricted u : Nat .
736      (lambda unrestricted system : (family DataParallelSystem c u) .
737        (lambda unrestricted layout : (family NativeDataParallelOwnedLayout) .
738          (lambda unrestricted tail : (family NativePhysicalCommands) .
739            (let unrestricted k =
740              (dpK c u system)
741              in
742              (let unrestricted owners =
743                (dpOwners c u system)
744                in
745                (let unrestricted leaf =
746                  (dpLeafAt (dpoGeneric layout))
747                  in
748                  (let unrestricted per =
749                    (dpoPerOwner k owners)
750                    in
751                    (stdListFold
752                      Nat
753                      (family NativePhysicalCommands)
754                      (lambda unrestricted owner : Nat .
755                        (lambda unrestricted rest : (family NativePhysicalCommands) .
756                          (let unrestricted target =
757                            (nativeCombineRegionEnd (dpoGradientAt layout owner))
758                            in
759                            (dpEach
760                              per
761                              (lambda unrestricted index : Nat .
762                                (lambda unrestricted more : (family NativePhysicalCommands) .
763                                  (let unrestricted coordinate =
764                                    (naturalAdd owner (naturalMultiply index owners))
765                                    in
766                                    (nat-eliminate
767                                      (lambda unrestricted inside : Nat .
768                                        (family NativePhysicalCommands))
769                                      (nativeMemoryStoreWord64
770                                        b"data-parallel-gradient-padding"
771                                        (nativePointwiseAt target index)
772                                        (nativeLaunchRecipeImmediate 0)
773                                        more)
774                                      (lambda unrestricted previous : Nat .
775                                        (lambda unrestricted ignored : (family NativePhysicalCommands) .
776                                        (dpCopy
777                                        (nativePointwiseAt target index)
778                                        (nativePointwiseAt leaf coordinate)
779                                        dpWord
780                                        more)))
781                                      (naturalLess coordinate k)))))
782                              (dpCopy
783                                (nativePointwiseAt target per)
784                                (nativePointwiseAt leaf k)
785                                dpWord
786                                rest)))))
787                      tail
788                      (stdListNaturalsBelow
789                        (stdListLength (family NativeCombinePlacement) (dpoGradients layout)))))))))))))

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.