POV-Ray : Newsgroups : povray.beta-test : Function (optimization?) bug Server Time
30 Jul 2024 08:29:33 EDT (-0400)
  Function (optimization?) bug (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: R  Suzuki
Subject: Function (optimization?) bug
Date: 24 Dec 2001 23:14:33
Message: <3c27fd29$1@news.povray.org>
Try the below code.
'funciton{-y/1/2}' should be same as 'function{-y/1/(2)}'.
But it behaves differently. 
(On the other hand, 'function{y/1/2}' is same as 'function{y/1/(2)}'.)

POV Win Beta 9, Win-Me

R. Suzuki

//---------------------------------------------------------------------
#version 3.5;

camera { location  z*-20 direction 3*z}

light_source {z*-50  color rgb 1}

box{-1,1 
  texture{pigment{function{-y/1/2}  color_map{[.0 rgb 0] [1 rgb 1]} }}
  translate <-1.5,1.5,0> }

box{-1,1 
  texture{pigment{function{-y/1/(2)}  color_map{[.0 rgb 0] [1 rgb 1]} }}
  translate <1.5,1.5,0>  }
 
box{-1,1 
  texture{pigment{function{y/1/2}  color_map{[.0 rgb 1] [1 rgb 0]} }}
  translate <-1.5,-1.5,0>}

box{-1,1 
  texture{pigment{function{y/1/(2)}  color_map{[.0 rgb 1] [1 rgb 0]} }}
  translate <1.5,-1.5,0> }
//------------------------------------------------


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Function (optimization?) bug
Date: 25 Dec 2001 06:42:10
Message: <3c286612$1@news.povray.org>
In article <3c27fd29$1@news.povray.org> , "R. Suzuki" <r-s### [at] aistgojp>
wrote:

> Try the below code.
> 'funciton{-y/1/2}' should be same as 'function{-y/1/(2)}'.
> But it behaves differently.
> (On the other hand, 'function{y/1/2}' is same as 'function{y/1/(2)}'.)

For debugging, use

#declare foo1 = function{"foo1.out" -y/1/(2)}
#declare foo2 = function{"foo2.out" -y/1/2}

and look at the output files.

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: R  Suzuki
Subject: Re: Function (optimization?) bug
Date: 25 Dec 2001 20:26:56
Message: <3c292760@news.povray.org>
"Thorsten Froehlich" wrote
> For debugging, use
>
> #declare foo1 = function{"foo1.out" -y/1/(2)}
> #declare foo2 = function{"foo2.out" -y/1/2}
>
> and look at the output files.

Followings are the output.  Apparently, foo2 has a problem (while others are
ok).

--------------------------------------------------
#declare foo1 = function{"foo1.out" -y/1/(2)}

grow    3
load    SP(0),R2
load    SP(1),R3
load    SP(2),R4
move    R5,R6
move    R0,R5
move    R3,R0
neg     R0,R5
move    R5,R0
move    R6,R5
move    R0,R5
muli    1.000000,R5   # const(1)
loadi   2.000000,R0   # const(2)
div     R0,R5
move    R5,R0
rts


#declare foo2 = function{"foo2.out" -y/1/2}

grow    3
load    SP(0),R2
load    SP(1),R3
load    SP(2),R4
move    R5,R6
move    R0,R5
move    R3,R0
neg     R0,R5
move    R5,R0
move    R6,R5
move    R0,R5
muli    2.000000,R5   # const(2)
move    R5,R0
rts


#declare foo3 = function{"foo3.out" y/1/(2)}

grow    3
load    SP(0),R2
load    SP(1),R3
load    SP(2),R4
move    R3,R0
move    R0,R5
muli    1.000000,R5   # const(1)
loadi   2.000000,R0   # const(2)
div     R0,R5
move    R5,R0
rts


#declare foo4 = function{"foo4.out" y/1/2}

grow    3
load    SP(0),R2
load    SP(1),R3
load    SP(2),R4
move    R3,R0
move    R0,R5
muli    1.000000,R5   # const(1)
muli    0.500000,R5   # const(3)
move    R5,R0
rts
--------------------------------------------

R. Suzuki


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Function (optimization?) bug
Date: 26 Dec 2001 07:53:09
Message: <3c29c835@news.povray.org>
In article <3c292760@news.povray.org> , "R. Suzuki" <r-s### [at] aistgojp> 
wrote:

> Followings are the output.  Apparently, foo2 has a problem (while others are
> ok).

Yes, internally it is for some not yet investigated reason optimised to
-y/0.5, which in turn is optimised to -y*2.  What it is supposed to do is
not optimise this expression at all...

    Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From:
Subject: Re: Function (optimization?) bug
Date: 28 Dec 2001 04:07:33
Message: <ihdo2uod1rgij0kpp9a0nl8bdt6q747miq@4ax.com>
On Tue, 25 Dec 2001 12:42:08 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
>
> For debugging, use
>
> #declare foo1 = function{"foo1.out" -y/1/(2)}
> #declare foo2 = function{"foo2.out" -y/1/2}
>
> and look at the output files.

Nice feature. Is it supposed to be included in official release or is it only
beta-test feature ? I ask becouse it seems not documented.

ABX


Post a reply to this message

From: Warp
Subject: Re: Function (optimization?) bug
Date: 28 Dec 2001 07:21:08
Message: <3c2c63b3@news.povray.org>

: Nice feature. Is it supposed to be included in official release or is it only
: beta-test feature ?

  It's also nice because you can actually modify that output by hand and then
read it as a function. This allows you doing things that the parser does not
support for one reason or another (eg. recursive calls).
  I don't believe it will be an official feature.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From:
Subject: Re: Function (optimization?) bug
Date: 28 Dec 2001 07:28:21
Message: <avoo2uoro3l4o0teltn03o18gdqvqffvl3@4ax.com>
On 28 Dec 2001 07:21:08 -0500, Warp <war### [at] tagpovrayorg> wrote:
>  It's also nice because you can actually modify that output by hand and then
> read it as a function.

How ? You mean when I write function{"file.txt" x+y+z} it outputs to file but
for example when I write function{"file.txt"} then this handmade code is readed?

> This allows you doing things that the parser does not
> support for one reason or another (eg. recursive calls).

Exactly.

>  I don't believe it will be an official feature.

If here is little place for feature request then this is my vote. Also I think
it could be useful for future bug reports (after final 3.5) but I'm affraid it
is not secure feature if it has read as option.

ABX


Post a reply to this message

From: Warp
Subject: Re: Function (optimization?) bug
Date: 28 Dec 2001 08:59:11
Message: <3c2c7aaf@news.povray.org>

: How ? You mean when I write function{"file.txt" x+y+z} it outputs to file but
: for example when I write function{"file.txt"} then this handmade code is readed?

  I don't remember exactly how it was read, but I remember Thorsten talking
about it. (I hope I didn't mispell his name; sorry if I did :) )

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Function (optimization?) bug
Date: 28 Dec 2001 12:24:54
Message: <3c2caae6@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

>>  I don't believe it will be an official feature.
>
> If here is little place for feature request then this is my vote. Also I think
> it could be useful for future bug reports (after final 3.5) but I'm affraid it
> is not secure feature if it has read as option.

It won't be included in any final release (there is a compile-time switch to
turn it off).  The reason is that one can "write" programs that reliably
crash and won't run in future version either because the function VM *will*
change.  The output is a more human-readable output of the function VM
instructions to help debugging the function compiler and optimizer.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From:
Subject: Re: Function (optimization?) bug
Date: 7 Jan 2002 05:48:14
Message: <stti3u8slu0c764ru6qq73vfmcqua3sslp@4ax.com>
On Fri, 28 Dec 2001 18:24:50 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> It won't be included in any final release (there is a compile-time switch to
> turn it off).  The reason is that one can "write" programs that reliably
> crash and won't run in future version either because the function VM *will*
> change.  The output is a more human-readable output of the function VM
> instructions to help debugging the function compiler and optimizer.

I wonder if there could be addition to documentation with some general rules of
optimizations made by function's parser. For example - is it enough when I write
just:

#macro P(F,G)
function{ x + F*y + z^G }
#end

or should I write:

#macro P(F,G)
function{ 
  x
  #if (F!=0) + #if (F=1) y #else F*y #end #end
  + #if (G=0) 1#else #if( G=1) z #else z^G #end #end
}
#end

At this beta time I have unofficial debug stream to check. But what later ?
Considering time of rendering and designing some general systems for isosurfaces
it is important to make as big optimisetion as possible. Not everybody know C to
verify function equation with source of optimizer.

Also I wonder if there could be inline type of function (code of function is
inlined at parsing time instead of calling at render time). So functions could
be unrolled first, and then optimizations applied.

Sorry, I know it is a feature request but I found this thread and this group
best place to add this, when you feel some other group better, send answer there

ABX


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.