LunarG/LunarGLASS

How to generate GPU backend binaries

xiaoqiang-wang opened this issue · 1 comments

Hello, my friends, @svenstaro @danginsburg @johnkslang @cnorthrop @jeremy-lunarg
I'm a graphics beginner, learning how to translate OpenGL SL to a target(like NV/MALI/AMD-GPU) instructions binnary,
I see your tools and successfully install it on my Linux, with minor changes.

change 1

add .a files to PathOfYourChoice/LunarGLASS$/CMakeLists.txt
add all .a files to the libs under glslang/build/install/lib
set(GLSLANGLIBS
	GenericCodeGen
	glslang
	glslang-default-resource-limits
	HLSL
	MachineIndependent
	OGLCompiler
	OSDependent
	SPIRV)

change 2

//remove the 2 un-necessary lines in  PathOfYourChoice/LunarGLASS/Standalone/main.cpp
//#include "glslang/Include/revision.h
//printf("Glslang Version: %s %s\n", GLSLANG_REVISION, GLSLANG_DATE);

changes 3

SET SPRIV .a files LIBRARY_PATH
export LIBRARY_PATH=/home/myworkdir/3RD_PART/SPIRV-Tools/build/install/usr/local/lib

install and run success

./LunarGOO -a test.vert

with above changes and command , I successfully generate Top-IR and Bottom-IR for my test.vert shader.
and I see the LunarGLASS/Core/LLVM/llvm-3.4/lib/Target/R600 is ADM-R600-GPU backend.

Questions

How can I translate test.frag or test.vert to ADM-R600-GPU binnaris? would you give me guidance.
Q1. How to use LLVM inline all functions?
Q2. Where should I add AMD-R600 backend pass?

Hello, my friends,

I see the LunarGLASS call to a backEnd as below(in Core/BottomTranslator.cpp), and it just do the print.

void gla::PrivateManager::translateBottomToTarget()
{
    PassManager passManager;
    // llvm will delete what we pass to add, so that has be newed
    passManager.add(new BottomTranslator(backEndTranslator, backEnd, this));
    passManager.run(*module);
}

I see the llvm-3.4 include AMD-R600-GPU backEnd.

Questions

Q1: Does there some similar pass for AMD-R600-GPU backEnd?
Q2: How can I new a pass, added it to passManager, and generate AMD-R600-GPU instruction binaries?