freenode/#sbcl - IRC Chatlog
Search
4:25:59
johnjay
i found a small CL project on github and downloaded it. been trying to fiddle with sbcl to run it
5:17:04
reepca
could someone with the latest sbcl try running http://paste.debian.net/1120751 and see what sort of error it produces?
5:17:05
minion
reepca, memo from phoe: oh, if you have a one-dimensional array, then COPY-SEQ will work, yes
10:42:44
phoe
Or rather, why does the type engine think that it can return a complex value? Isn't it that only possible when SQRT receives a negative number as its input?
10:48:15
phoe
(* x x) is always supposed to be non-negative and a sum of three non-negative values is always supposed to be non-negative
10:53:22
phoe
it seems that SBCL thinks that (* x x) is of type SINGLE-FLOAT but (expt x 2) is of type (SINGLE-FLOAT 0.0)
10:54:24
no-defun-allowed
When I did (defun f (x) (declare (real x)) (* x x)), I got an OR type of all the positive real representations.
11:09:59
scymtym
for (lambda (x) (declare (type single-float x)) (sqrt (* x x))) SBCL knows that the result will be a real
11:12:34
edgar-rft
phoe: if I (declare (type single-float ox oy oz vx vy vz)) after the with-accessors lines the compiler warning goes away
11:12:52
reepca
I think it has something to do with with-accessors. I replaced the inner with-accessors with a simple let binding and I don't get any notes.
11:20:53
scymtym
for a lexical variable x, the compiler knows that (* x x) is non-negative. for a function call (even a structure slot reader), the compiler doesn't know that (* (x v) (x v)) is non-negative
11:21:44
scymtym
the latter case would require some form of common sub-expression elimination which SBCL doesn't do. as a result, the WITH-ACCESSORS variant also loads the structure slot values into MMX registers twice
11:30:20
minion
karlosz, memo from flip214: we're scheduling right now... please tell us all topics and approx. time
12:06:42
mfiano
scymtym: phoe was posting on behalf of me. I went ahead and replaced with-accessors with a symbol-macrolet to do the aref's instead of calling a structure's functions. I am still having the exact same problem. here is the code, if you have any ideas: https://gist.github.com/mfiano/3cb843b22e276c8756ab69d95cf08a9d
12:16:07
mfiano
adding (declare (single-float length)) fixes it. apparently SBCL still wants to treat the result of SQRT as possibly complex
12:31:24
phoe
the issue I see is that (* (aref x 0) (aref x 0)) is still not detected as non-negative even if X is an array of single-floats
12:33:24
pkhuong
and only doing them once would call for a real memory model. SBCL's is currently similar to a "everything is volatile"
12:34:25
pkhuong
we might want to change that, but that calls for hard thinking (or stealing someone else's work)
12:36:53
pkhuong
2. even once you recognize that two values are EQ, propagating bounds on correlated values is hard. we can detect when two lvars
12:38:21
pkhuong
the constraint pass does have the information we want, but its current interface with ir1 optimisations is just updating the type of lvars
13:19:53
pkhuong
oh. and i guess a transform is broken if it makes cprop wrong in an observable manner
13:20:44
pkhuong
i'm talking about passing equality constraint info back to transforms. in this case, though, just the type deriver would suffice
13:21:26
stassats
the constraints just remain on the refs, as it appears nothing is needed to clear them
13:36:26
stassats
and things like x is < than (+ x 2) would be useful for bound checking elimination