[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-dev
Subject: Re: [LLVMdev] OT: new here, dynamic/runtime compilation (in general)
From: "BGB" <cr88192 () hotmail ! com>
Date: 2007-10-22 3:51:41
Message-ID: BLU119-DAV1309A294D57F68409D3BA1E49A0 () phx ! gbl
[Download RAW message or body]
----- Original Message -----
From: Chris Lattner
To: BGB
Cc: LLVM Developers Mailing List
Sent: Monday, October 22, 2007 12:28 PM
Subject: Re: [LLVMdev] OT: new here, dynamic/runtime compilation (in general)
On Oct 21, 2007, at 6:23 PM, BGB wrote:
ok, just in my case, I guess I am a little fussy/weird, wanting efficient dot and \
cross products (if at all possible, though these operations at present don't exist \
natively within SSE...), among many other operations (length, lerp, renormalization, \
..).
then again, probably a fairly smart compiler could still get plenty good results \
out of inline functions and intrinsics or something (as it so happens, my compiler is \
not so smart here, so I made these features builtin, and fell back to functions for \
more involved operations, such as quaternion slerp, ...).
llvm-gcc and clang both fully support GCC style generic vectors and altivec/sse \
intrinsics. In addition, clang supports "glsl" style vector permutations, direct \
vector element access, etc. The LLVM optimizer and code generator supports many \
vector operations independent of the front-end syntax, as well as highly optimized \
code generation for Altivec and SSE.
yes, cool.
in any case, people can probably build whatever they need using what is provided...
(and, if all this is already built in, all the better...).
but, yes, it may not matter much, I simply have some stuff that is non-standard and \
tweaky is all...
sorry if it seems I am obsessing, or if this topic seems inappropriate here...
looking, trying to determine if GLSL has these operations (ok, it has a few, \
implemented as functions at least, like 'dot' and 'cross'). note that my interface is \
a little different than GLSL, but I may change it to more closely resemble that of \
GLSL.
now, of course, what I was not sure of (what I keep going on about) was not about \
specific general vector features (aka: much of anything what SSE itself, or most \
compilers, provide), but the specifics of geometric vectors (like in 3D or physics).
(one has special fun trying to implement these well within the context of SSE...).
I have some funky operator overloading as well: 'vec^vec' gives a dot product \
('vec*vec' gives a per-component product, as in gcc); and 'vec%vec' gives a cross \
product. for quaternions, 'quat*quat' is overloaded for a quaternion product \
(grassman).
per-component access:
I treat vectors like some kind of implicit struct.
components are: x,y,z,w. i, j, and k are analogous to x, y, and z.
looks like GLSL also has r, g, b, and a as synonyms as well (don't have these in my \
case, then again, I don't usually do color calculations either...).
so, for a vector v: v.x, v.y, v.z, or v.w; or a quat q: q.i, q.j, q.k, or q.w.
I also do this for complexes, where complexes are viewed as having 2 components: i \
and w (matching them with quaternions as such).
so, it is valid to type: "(float _Complex)QUAT(3,1,0,0);", which comes out as the \
complex "3+1i" (j and k are simply discarded). note that, at present, it is not \
possible to type out quaternions like complexes, say "(3+1i+0j+0k)*(0+5i+1j-2k)", \
though this could be a sane feature, it would also give pressure to allow similar for \
vectors, such as ("3x+4y-5z", which may look odd and misleading), and simply allowing \
it for complexes may be enough...
hmm: as for vectors, the funky syntax could be very useful for translation and \
accelaration ("vel-=gravity*1z;", as opposed to "gavity-=VEC3(0,0,gravity);").
who knows though...
misc, quaternions (general concept):
http://en.wikipedia.org/wiki/Quaternion
-Chris
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3199" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY
style="WORD-WRAP: break-word; khtml-nbsp-mode: space; khtml-line-break: \
after-white-space" bgColor=#ffffff>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 \
2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">----- Original Message \
----- </DIV> <DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=sabre@nondot.org href="mailto:sabre@nondot.org">Chris Lattner</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=cr88192@hotmail.com
href="mailto:cr88192@hotmail.com">BGB</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=llvmdev@cs.uiuc.edu
href="mailto:llvmdev@cs.uiuc.edu">LLVM Developers Mailing List</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, October 22, 2007 12:28
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [LLVMdev] OT: new here,
dynamic/runtime compilation (in general)</DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT
face=Arial size=2></FONT><BR></DIV><BR>
<DIV>
<DIV>On Oct 21, 2007, at 6:23 PM, BGB wrote:</DIV><BR
class=Apple-interchange-newline>
<BLOCKQUOTE type="cite"><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: \
rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; \
BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: \
none; apple-text-size-adjust: auto; orphans: 2; widows: 2"> <DIV dir=ltr><FONT \
face=Arial size=2><SPAN class=Apple-style-span style="FONT-SIZE: 10px; FONT-FAMILY: \
Arial">ok, just in my case, I guess I am a little fussy/weird, \
wanting efficient dot and cross products (if at all possible, though \
these operations at present don't exist natively within SSE...), among many other \
operations (length, lerp, renormalization,
..).</SPAN></FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2><SPAN class=Apple-style-span
style="FONT-SIZE: 10px; FONT-FAMILY: Arial">then again, probably a fairly
smart compiler could still get plenty good results out of inline functions
and intrinsics or something (as it so happens, my compiler is not so smart
here, so I made these features builtin, and fell back to functions for more
involved operations, such as quaternion slerp, ..).</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT
face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><BR
class=khtml-block-placeholder></DIV></SPAN></BLOCKQUOTE>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT
face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><BR class=khtml-block-placeholder></DIV>
<DIV>llvm-gcc and clang both fully support GCC style generic vectors and
altivec/sse intrinsics. In addition, clang supports "glsl" style vector
permutations, direct vector element access, etc. The LLVM optimizer and
code generator supports many vector operations independent of the front-end
syntax, as well as highly optimized code generation for Altivec and
SSE.</DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT
face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT
face=Arial size=2></FONT> </DIV></BLOCKQUOTE>
<DIV><FONT face=Arial size=2>yes, cool.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>in any case, people can probably build whatever
they need using what is provided...</FONT></DIV>
<DIV><FONT face=Arial size=2>(and, if all this is already built in, all the
better...).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>
<DIV><FONT face=Arial size=2>but, yes, it may not matter much, I simply have
some stuff that is non-standard and tweaky is all...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></DIV>
<DIV><FONT face=Arial size=2>sorry if it seems I am obsessing, or if this topic
seems inappropriate here...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>looking, trying to determine if GLSL has these
operations (ok, it has a few, implemented as functions at least, like 'dot' and
'cross'). note that my interface is a little different than GLSL, but
I may change it to more closely resemble that of GLSL.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>now, of course, what I was not sure of (what I keep
going on about) was not about specific general vector features (aka: much of
anything what SSE itself, or most compilers, provide), but the specifics
of geometric vectors (like in 3D or physics).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>(one has special fun trying to implement
these well within the context of SSE...).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have some funky operator overloading as well:
'vec^vec' gives a dot product ('vec*vec' gives a per-component product, as in
gcc); and 'vec%vec' gives a cross product. for quaternions, 'quat*quat' is
overloaded for a quaternion product (grassman).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>per-component access:</FONT></DIV>
<DIV><FONT face=Arial size=2>I treat vectors like some kind of implicit
struct.</FONT></DIV>
<DIV><FONT face=Arial size=2>components are: x,y,z,w. i, j, and k are analogous
to x, y, and z.</FONT></DIV>
<DIV><FONT face=Arial size=2>looks like GLSL also has r, g, b, and a as synonyms
as well (don't have these in my case, then again, I don't usually do color
calculations either...).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>so, for a vector v: v.x, v.y, v.z, or v.w; or
a quat q: q.i, q.j, q.k, or q.w.</FONT></DIV>
<DIV><FONT face=Arial size=2>I also do this for complexes, where complexes are
viewed as having 2 components: i and w (matching them with quaternions as
such).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>so, it is valid to type: </FONT><FONT face=Arial
size=2>"(float _Complex)QUAT(3,1,0,0);", which comes out
as the complex</FONT></DIV>
<DIV><FONT face=Arial size=2>"3+1i" (j and k are simply discarded). note that,
at present, it is not possible to type out quaternions like complexes, say
"(3+1i+0j+0k)*(0+5i+1j-2k)", though this could be a sane feature, it would
also give pressure to allow similar for vectors, such as ("3x+4y-5z", which may
look odd and misleading), and simply allowing it for complexes may be
enough...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>hmm: as for vectors, the funky syntax could be very
useful for translation and accelaration ("vel-=gravity*1z;", as opposed to
"gavity-=VEC3(0,0,gravity);").</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>who knows though...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>misc, quaternions (general
concept):</FONT></DIV>
<DIV><FONT face=Arial size=2><A
href="http://en.wikipedia.org/wiki/Quaternion">http://en.wikipedia.org/wiki/Quaternion</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 \
2px solid; MARGIN-RIGHT: 0px"> <DIV><FONT face=Arial size=2></FONT><FONT face=Arial \
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT \
face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><BR
class=khtml-block-placeholder></DIV>
<DIV>-Chris</DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT
face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><BR></DIV><BR></BLOCKQUOTE></BODY></HTML>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic