TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.StaticByte.Plan.Runtime

Static-byte planning runtime #

Nominal binary formats of at most eight bits use cost estimates, table candidates, profile selection, and dispatch specialized to static-byte storage.

Correctness theorems live in Plan.Proof, while capability construction lives in Plan.Construction. This runtime layer can therefore be reused without importing either module.

Cost estimate for evaluating the exact baseline directly.

This is the mandatory proved implementation in table-backed plans. The constants are calibration inputs, not semantic facts; changing them can alter a plan without changing any refinement theorem.

Instances For

    Estimate a dense byte-result table from the format width and operation arity.

    Table construction evaluates a certified kernel once per entry. residentBytes counts the result bytes in the cached ByteArray; it excludes object and allocator overhead.

    Instances For
      @[inline]
      def FloatLib.Floats.Formats.BinaryInterchange.StaticByte.Plans.binaryTableCertified {F : Type u} [Family F] (name : String) (operation : ExecFloat.Backend.Operation) (spec run : ExecFloat FExecFloat FExecFloat F) (run_eq_spec : ∀ (left right : ExecFloat F), run left right = spec left right) :

      Certify a binary kernel with the table cost estimate.

      Instances For
        def FloatLib.Floats.Formats.BinaryInterchange.StaticByte.Plans.binaryTable {F : Type u} [Family F] (name : String) (operation : ExecFloat.Backend.Operation) (spec run : ExecFloat FExecFloat FExecFloat F) (run_eq_spec : ∀ (left right : ExecFloat F), run left right = spec left right) :

        Certified binary table candidate paired with the executable exact baseline.

        Instances For
          @[inline]
          def FloatLib.Floats.Formats.BinaryInterchange.StaticByte.Plans.unaryTableCertified {F : Type u} [Family F] (name : String) (operation : ExecFloat.Backend.Operation) (spec run : ExecFloat FExecFloat F) (run_eq_spec : ∀ (value : ExecFloat F), run value = spec value) :

          Certify a unary kernel with the table cost estimate.

          Instances For
            def FloatLib.Floats.Formats.BinaryInterchange.StaticByte.Plans.unaryTable {F : Type u} [Family F] (name : String) (operation : ExecFloat.Backend.Operation) (spec run : ExecFloat FExecFloat F) (run_eq_spec : ∀ (value : ExecFloat F), run value = spec value) :

            Certified unary table candidate paired with the executable exact baseline.

            Instances For
              @[inline]
              def FloatLib.Floats.Formats.BinaryInterchange.StaticByte.Plans.ternaryTableCertified {F : Type u} [Family F] (name : String) (operation : ExecFloat.Backend.Operation) (spec run : ExecFloat FExecFloat FExecFloat FExecFloat F) (run_eq_spec : ∀ (left right addend : ExecFloat F), run left right addend = spec left right addend) :

              Certify a ternary kernel with the table cost estimate.

              Instances For
                def FloatLib.Floats.Formats.BinaryInterchange.StaticByte.Plans.ternaryTable {F : Type u} [Family F] (name : String) (operation : ExecFloat.Backend.Operation) (spec tableRun exactRun : ExecFloat FExecFloat FExecFloat FExecFloat F) (tableRun_eq_spec : ∀ (left right addend : ExecFloat F), tableRun left right addend = spec left right addend) (exactRun_eq_spec : ∀ (left right addend : ExecFloat F), exactRun left right addend = spec left right addend) :

                Certified ternary table candidate paired with a first-order executable exact baseline.

                Keeping the baseline as a named proved kernel matters for formats whose balanced policy rejects a large FMA table: public execution can then specialize to that kernel without calling the generic family specification through a boxed dictionary.

                Instances For
                  @[inline]

                  Whether the shared planner selects the exhaustive table over the exact baseline.

                  Static-byte portfolios contain exactly one optional table candidate. Repeating the selector's single comparison as a Bool lets a monomorphic operation branch between two named first-order kernels without projecting an executable closure from Certified. The cost calculation remains identical to Backend.selectCertified, so planning reports and execution use the same choice.

                  Instances For

                    Certified table choices for the three built-in planning profiles.

                    Closed nominal formats provide these three bits once per operation. Their equality fields prove that the literals are exactly the result of the shared cost model. The compiler can then reduce a built-in profile to a direct kernel while a custom profile retains the general runtime comparison.

                    Instances For
                      @[always_inline]

                      The latency profile rejects a table accepted by balanced and throughput planning.

                      Instances For
                        @[always_inline]

                        Among the built-in profiles, only throughput selects this table.

                        Instances For
                          @[always_inline]

                          Choose a table from a statically recognizable profile or evaluate an application-defined policy.

                          Instances For
                            @[always_inline]
                            def FloatLib.Floats.Formats.BinaryInterchange.StaticByte.Plans.executeBinary {F : Type u} [Family F] [planning : ExecFloat.Backend.PolicyFor F] (name : String) (operation : ExecFloat.Backend.Operation) (selection : BuiltinSelection (Family.format F) name operation) (spec run : ExecFloat FExecFloat FExecFloat F) (left right : ExecFloat F) :

                            Execute the supplied binary table kernel or baseline according to the planning profile.

                            Instances For
                              @[always_inline]

                              Execute the supplied unary table kernel or baseline according to the planning profile.

                              Instances For
                                @[always_inline]
                                def FloatLib.Floats.Formats.BinaryInterchange.StaticByte.Plans.executeTernary {F : Type u} [Family F] [planning : ExecFloat.Backend.PolicyFor F] (name : String) (operation : ExecFloat.Backend.Operation) (selection : BuiltinSelection (Family.format F) name operation) (tableRun exactRun : ExecFloat FExecFloat FExecFloat FExecFloat F) (left right addend : ExecFloat F) :

                                Execute the supplied ternary table kernel or baseline according to the planning profile.

                                Instances For