On Tue, 2010-03-30 at 09:52 -0700, Luca Barbieri wrote: > > There are several deep challenges in making TGSI <-> LLVM IR translation > > lossless -- I'm sure we'll get around to overcome them -- but I don't > > think that using LLVM is a requirement for this module. Having a shared > > IR for simple TGSI optimization module would go a long way by itself. > > What are these challenges?
- Control flow as you mentioned -- gets broken into jump spaghetti. - Predicates can't be represented -- you need to use AND / NAND masking. I know people have asked support for this in the LLVM list so it might change someday. - missing intrinsics -- TGSI has a much richer instruction set than LLVM's builtin instructions, so it would be necessary to add several llvm.tgsi.xxx instrinsics (e.g., for max, min, madd, exp2, log2, etc), and teach LLVM to do constant propagation for every single one of them. - Constants -- you often want to make specialized version of shaders for certain constants, especially when you have control flow statements whose arguments are constants (e.g., when doing TNL with a big glsl shader), and therefore should be factored out. You also may want to do factor out constant operations (e.g., MUL TEMP[1], CONST[0], CONST[1]) But LLVM can't help you with that given that for LLVM IR constants are ordinary memory, like the inputs. LLVM doesn't know that a shader will be invoked million of times with the same constants but varying inputs. If people can make this TGSI optimization module work quickly on top of LLVM then it's fine by me. I'm just pointing out that between the extreme of sharing nothing between each pipe driver compiler, and sharing everything with LLVM, there's a middle ground which is sharing between pipe drivers but not LLVM. Once that module exists having it use LLVM internally would then be pretty easy. It looks to me a better way to parallize the effort than to be blocked for quite some time on making TGSI <-> LLVM IR be lossless. At any rate, in my book whoever does the job gets to choose. I won't have any time to put into it unfortunately, so feel free to ignore me. Jose ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev