Hi,
I hope to be pretty exhaustive of options for parsing and translating between graphics and compute shaders ( some open source)
For DX shaders:
*GPU Shader analyzer (AMD ONLY)(get DX IL and get AMD IL and GPU assembly from DirectCompute shaders or graphic shaders): now is dx11 compatible and 5xxx series and has compute domain and hull shaders..
*fxc and D3DCompile API and lib: get DX IL and bytecode from DX shaders (multivendor)
note I don't know how to build from DX IL as D3DCompile doesn't accept and also not CreateComputeShader.. finally GPU SA doesn't want to eat too..
it's a fxc option or API for going from DX IL to DX BC so I can optimize DX IL and then compile to DX ByteCode and feed that to a compute shader?
at least if you have source you can see AMD IL, DX IL and R800 assembly and
teoretically you can get AMD IL from Compute shaders using GPU SA and feed into OpenCL when it support getting binaries and building from it (or intercepting now llc or something like that).. so in OpenCL you can modify generated assembly soon (on Nvidia now..)
so you can compare quailty of generated code..
Also now you can feed DX shaders to GPU SA and a equivalent OCL shader through SKA and compare AMD IL, assembly and even all the info of ALU/tex kernels/s etc..
I have tested simple vectoradd and quality is the same (kernels/s) altough AMD IL from OCL seems much longer..
Parsing HLSL: you have Nvidia CG compiler source so CG=HLSL in 99% so you have parser and front end compiler code.. (I think it has some flex bison things)
There was a AMD HLSL which was extension to HLSL having scatter doubles etc..
http://coachk.cs.ucf.edu/courses/CDA6938/s08/UCF-2008-02-01b.pdf
http://coachk.cs.ucf.edu/courses/CDA6938/s08/AMD_IL.pdf
Now included in compute shader 5.0 and pixel shader 5.0 in DX11 all functionality also included in upcoming GLSL ext_gpu_shader5 I presume (I can't find AMD HLSL compiler anywhere so I think efforts migrated to Brook+ efforts and AMD IL):
Note for Nvidia there is a tool similar to GPU SA but I think it's payed (ShaderPerf, perfkit can't I think..)
Have to see if Nexus will have PTX code from shaders or anything like that..
Also DX11 support is missing naturally in all tools (Perfkit, shaderperf,etc..)
HLSL<->GLSL source to source translation:
hlsl2glsl-v0.9 (OpenGL ES also source code)
babelshader
Only pixel vertex shaders..
GLSL
GPU Shader analyzer (get AMD IL from DirectCompute shaders or graphic shaders)
you can use HLSL->GLSL and using GPU SKA compare quality of generated GLSL vs HLSL AMD IL or assembly code..
Parsing GLSL:
you have flex and bison almost from spec (tokens and grammar)..
3d labs glsl validate and front end compiler open source..
(i can't find)
hlsl2glsl-v0.9..
Brook+ is open source
has AMD IL code gen source and brook parsing (ctool based)
Another thing is measuring perf of not shaders of whole thing with OpenGL gdebugger, mac OpenGL perf libs, AMD GPU 2.1, Nvidia Nexus and GL perf API and libs(perfkit sdk),
For having similar to OpenCL CAL lib see CAL++.
For porting CUDA to OpenCL there are to guides from Nvidia and AMD and:
Experiences porting from CUDA to OpenCL
Presentation at the Daresbury Machine Evaluation Workshop, 2009
also a tool:
Swan: A simple tool for porting CUDA kernels to OpenCL
A good OpenCL to DirectCompute driver wuold be good!
Thursday, 25 February 2010
Shaders: measuring perf, source translation and parsing different languages!
Posted on 07:07 by Unknown
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment