Chris Lattner sabre at nondot.org
Tue Aug 15 15:52:19 CDT 2006
* Previous message: [LLVMdev] OOPLSA 2006 Call for Participation
* Next message: [LLVMdev] Re: A cool use of LLVM at Apple: the OpenGL stack
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[I just got official okay to mention this in public. This was previously
announced at Apple's WWDC conference last week.]
For those who are interested,
Apple announced that they are using the LLVM
optimizer and JIT within their Mac OS 10.5 'Leopard' OpenGL stack (which
was distributed in beta form to WWDC attendees).
LLVM is used in two different ways, at runtime:
1. Runtime code specialization within the fixed-function vertex-processing
pipeline. Basically, the OpenGL pipeline has many parameters (is fog
enabled? do vertices have texture info? etc) which rarely change:
executing the fully branchy code swamps the branch predictors and
performs poorly. To solve this, the code is precompiled to LLVM .bc
form, from which specializations of the code are made, optimized,
and JIT compiled as they are needed at runtime.
2. OpenGL vertex shaders are small programs written using a family of
programming langauges with highly domain-specific features (e.g. dot
product, texture lookup, etc). At runtime, the OpenGL stack translates
vertex programs into LLVM form, runs LLVM optimizer passes and then JIT
compiles the code.
Both of these approaches make heavy use of manually vectorized code using
SSE/Altivec intrinsics, and they use the LLVM x86-32/x86-64/ppc/ppc64
targets. LLVM replaces existing special purpose JIT compilers built by
the OpenGL team.
LLVM is currently used when hardware support is disabled or when the
current hardware does not support a feature requested by the user app.
This happens most often on low-end graphics chips (e.g. integrated
graphics), but can happen even with the high-end graphics when advanced
capabilities are used.
Like any good compiler, the only impact that LLVM has on the OpenGL stack
is better performance (there are no user-visible knobs). However, if you
sample a program using shark, you will occasionally see LLVM methods in
the stack traces. :)
-Chris
若你在年轻时上过水木, 它会一生跟随着你, 如一场浮动的盛宴
禁色和禁果仍被保存吗?
这世界有否给潜移默化?
离过家回了家仍住中环吗?
-----信有带到新居里烧吗?
一切美好的都会消失
人要是没有理想, 跟咸鱼有什么两样?
“把人们引向艺术和科学的最强烈动机之一,是要逃避日常生活中令人厌恶的粗俗和使人绝望的沉闷,是要摆脱人们自己反复无常的欲望的桎梏。一个修养有素的人总是渴望逃避个人生活而进入客观直觉和思维的世界。”
不要忘了,这个世界穿透一切高墙的东西,它就在我们的内心深处,他们无法达到,也接触不到,那就是希望。(FROM《肖申克的救赎》)