Skip to content

Scala host emits broken Lisp code for differentiation primitives (sin/cos/exp/log/sqrt) #453

@joshsh

Description

@joshsh

After landing the scala-host dispatch fixes in b81823431f (which added clojure/scheme/common-lisp/emacs-lisp to the scala host's target switch), the 4 sc→Lisp cells now reach test execution. All 4 fail in the same common > differentiation > ... test cluster:

  • sc→clj: 2549 pass / 23 fail / 7 skip. All 23 fails are common > differentiation > * (unary primitives, chain rule, evaluate derivatives, gradient check). EXCEPTION: with no further detail.
  • sc→cl: SBCL bails at first error: LAMBDA (TERM) :IN run-tests.lisp with (:APPLICATION ((:FUNCTION :VARIABLE "hydra.lib.math.sin") (:ARGUMENT :VARIABLE "x"))) — the unhandled condition is in evaluating a generated sin(x) term.

By comparison, p→clj (python host emitting same target) has 0 differentiation failures in the same 2572-test suite. So the bug is specific to scala host's emission of the differentiation primitives for Lisp targets.

Root cause hypothesis: scala host's Hydra.Sources.Scala.Lib.Math may emit incorrect Lisp-target trampolines for the math primitives, or the differentiation primitive itself (hydra.differentiation.*) is being emitted without the runtime support the Lisp dialects need.

Out of scope of #5sc (the dispatch gap) — this is the post-dispatch coder bug. #5sc's title was filed against the dispatch issue; the dispatch is fixed and this is the next layer.

Reproduction:

bin/run-bootstrapping-demo.sh --hosts scala --targets clojure
# 2549 pass / 23 fail (all common > differentiation > ...)

Discovered while: running the #409 v7 sweep after landing scala-host dispatch fixes for the 4 Lisp dialects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions