-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit consists of the original changes made by s-perron that emits a relocatable entry for each descriptor load, instead of baking in a constant offset during initial compilation. The compiler patches up the compiled binary with actual descriptor offset at a later time when that info is available.
- Loading branch information
Yong He
committed
Mar 12, 2020
1 parent
428a1e2
commit 5d6bea0
Showing
8 changed files
with
440 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
; BEGIN_SHADERTEST | ||
; RUN: amdllpc -spvgen-dir=%spvgendir% -use-relocatable-shader-elf -o test_cs_pipeline_out_relocconst.elf %gfxip %s && llvm-objdump -triple=amdgcn -mcpu=gfx900 -d test_cs_pipeline_out_relocconst.elf | FileCheck -check-prefix=SHADERTEST %s && rm test_cs_pipeline_out_relocconst.elf | ||
; SHADERTEST-LABEL: 0000000000000000 _amdgpu_cs_main: | ||
; SHADERTEST: s_mov_b32 s[[RELOREG:[0-9]+]], 0 //{{.*}} | ||
; SHADERTEST: s_load_dwordx4 s[{{.*}}:{{.*}}], s[{{.*}}:{{.*}}], s[[RELOREG]] //{{.*}} | ||
; END_SHADERTEST | ||
|
||
; BEGIN_SHADERTEST | ||
; RUN: amdllpc -spvgen-dir=%spvgendir% -use-relocatable-shader-elf -v %gfxip %s | FileCheck -check-prefix=SHADERTEST1 %s | ||
; SHADERTEST1-LABEL: {{^// LLPC}} pipeline patching results | ||
; SHADERTEST1: %[[RELOCONST:[0-9]+]] = call i32 @llvm.amdgcn.reloc.constant(metadata !{{.*}}) | ||
; SHADERTEST1: %[[RELOCONSTEXT:[0-9]+]] = zext i32 %[[RELOCONST]] to i64 | ||
; SHADERTEST1: %[[BUFFERDESCPTR:[0-9]+]] = getelementptr [4294967295 x i8], [4294967295 x i8] addrspace(4)* %{{.*}}, i64 0, i64 %[[RELOCONSTEXT]] | ||
; SHADERTEST1: %[[BUFFERADDR:[0-9]+]] = bitcast i8 addrspace(4)* %[[BUFFERDESCPTR]] to <4 x i32> addrspace(4)*, !amdgpu.uniform !{{.*}} | ||
; SHADERTEST1: %{{[0-9]+}} = load <4 x i32>, <4 x i32> addrspace(4)* %[[BUFFERADDR]], align 16, !invariant.load !{{.*}} | ||
; SHADERTEST1: AMDLLPC SUCCESS | ||
; END_SHADERTEST | ||
|
||
[CsGlsl] | ||
#version 450 | ||
#extension GL_ARB_separate_shader_objects : enable | ||
|
||
layout(binding = 0) uniform UniformBufferObject { | ||
vec4 i; | ||
} ubo; | ||
|
||
layout(set = 1, binding = 0, std430) buffer OUT | ||
{ | ||
vec4 o; | ||
}; | ||
|
||
layout(local_size_x = 2, local_size_y = 3) in; | ||
void main() { | ||
o = ubo.i; | ||
} | ||
|
||
|
||
[CsInfo] | ||
entryPoint = main | ||
userDataNode[0].type = DescriptorTableVaPtr | ||
userDataNode[0].offsetInDwords = 0 | ||
userDataNode[0].sizeInDwords = 1 | ||
userDataNode[0].set = 0 | ||
userDataNode[0].next[0].type = DescriptorBuffer | ||
userDataNode[0].next[0].offsetInDwords = 0 | ||
userDataNode[0].next[0].sizeInDwords = 8 | ||
userDataNode[0].next[0].set = 0 | ||
userDataNode[0].next[0].binding = 0 | ||
userDataNode[1].type = DescriptorTableVaPtr | ||
userDataNode[1].offsetInDwords = 1 | ||
userDataNode[1].sizeInDwords = 1 | ||
userDataNode[1].set = 1 | ||
userDataNode[1].next[0].type = DescriptorBuffer | ||
userDataNode[1].next[0].offsetInDwords = 0 | ||
userDataNode[1].next[0].sizeInDwords = 8 | ||
userDataNode[1].next[0].set = 1 | ||
userDataNode[1].next[0].binding = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
|
||
; BEGIN_SHADERTEST | ||
; RUN: amdllpc -spvgen-dir=%spvgendir% -use-relocatable-shader-elf -o test_pipeline_out_relocconst.elf %gfxip %s && llvm-objdump -triple=amdgcn -mcpu=gfx900 -d test_pipeline_out_relocconst.elf | FileCheck -check-prefix=SHADERTEST %s && rm test_pipeline_out_relocconst.elf | ||
; SHADERTEST-LABEL: 0000000000000000 _amdgpu_vs_main: | ||
; SHADERTEST: s_mov_b32 s[[RELOREG:[0-9]+]], 0 //{{.*}} | ||
; SHADERTEST: s_load_dwordx4 s[{{.*}}:{{.*}}], s[{{.*}}:{{.*}}], s[[RELOREG]] //{{.*}} | ||
; SHADERTEST: {{[0-9A-Za-z]+}} _amdgpu_ps_main: | ||
; END_SHADERTEST | ||
|
||
; BEGIN_SHADERTEST | ||
; RUN: amdllpc -spvgen-dir=%spvgendir% -use-relocatable-shader-elf -v %gfxip %s | FileCheck -check-prefix=SHADERTEST1 %s | ||
; SHADERTEST1-LABEL: {{^// LLPC}} pipeline patching results | ||
; SHADERTEST1: %[[RELOCONST:[0-9]+]] = call i32 @llvm.amdgcn.reloc.constant(metadata !{{.*}}) | ||
; SHADERTEST1: %[[RELOCONSTEXT:[0-9]+]] = zext i32 %[[RELOCONST]] to i64 | ||
; SHADERTEST1: %[[BUFFERDESCPTR:[0-9]+]] = getelementptr [4294967295 x i8], [4294967295 x i8] addrspace(4)* %{{.*}}, i64 0, i64 %[[RELOCONSTEXT]] | ||
; SHADERTEST1: %[[BUFFERADDR:[0-9]+]] = bitcast i8 addrspace(4)* %[[BUFFERDESCPTR]] to <4 x i32> addrspace(4)*, !amdgpu.uniform !{{.*}} | ||
; SHADERTEST1: %{{[0-9]+}} = load <4 x i32>, <4 x i32> addrspace(4)* %[[BUFFERADDR]], align 16, !invariant.load !{{.*}} | ||
; SHADERTEST1: AMDLLPC SUCCESS | ||
; END_SHADERTEST | ||
|
||
[VsGlsl] | ||
#version 450 | ||
#extension GL_ARB_separate_shader_objects : enable | ||
|
||
layout(binding = 0) uniform UniformBufferObject { | ||
mat4 model; | ||
mat4 view; | ||
vec4 proj; | ||
} ubo; | ||
|
||
layout(location = 0) in vec2 inPosition; | ||
layout(location = 1) in vec3 inColor; | ||
|
||
layout(location = 0) out vec3 fragColor; | ||
|
||
void main() { | ||
gl_Position = ubo.proj; | ||
fragColor = inColor; | ||
} | ||
|
||
|
||
[VsInfo] | ||
entryPoint = main | ||
userDataNode[0].type = IndirectUserDataVaPtr | ||
userDataNode[0].offsetInDwords = 0 | ||
userDataNode[0].sizeInDwords = 1 | ||
userDataNode[0].indirectUserDataCount = 0 | ||
userDataNode[1].type = DescriptorTableVaPtr | ||
userDataNode[1].offsetInDwords = 1 | ||
userDataNode[1].sizeInDwords = 4 | ||
userDataNode[1].set = 0 | ||
userDataNode[1].next[0].type = DescriptorBuffer | ||
userDataNode[1].next[0].offsetInDwords = 0 | ||
userDataNode[1].next[0].sizeInDwords = 8 | ||
userDataNode[1].next[0].set = 0 | ||
userDataNode[1].next[0].binding = 0 | ||
|
||
trapPresent = 0 | ||
debugMode = 0 | ||
enablePerformanceData = 0 | ||
vgprLimit = 0 | ||
sgprLimit = 0 | ||
maxThreadGroupsPerComputeUnit = 0 | ||
|
||
[FsGlsl] | ||
#version 450 | ||
#extension GL_ARB_separate_shader_objects : enable | ||
|
||
layout(location = 0) in vec3 fragColor; | ||
layout(location = 0) out vec4 outputColor; | ||
void main() { | ||
outputColor = vec4(fragColor, 1.0); | ||
} | ||
|
||
[FsInfo] | ||
entryPoint = main | ||
trapPresent = 0 | ||
debugMode = 0 | ||
enablePerformanceData = 0 | ||
vgprLimit = 0 | ||
sgprLimit = 0 | ||
maxThreadGroupsPerComputeUnit = 0 | ||
|
||
[GraphicsPipelineState] | ||
topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP | ||
patchControlPoints = 0 | ||
deviceIndex = 0 | ||
disableVertexReuse = 0 | ||
switchWinding = 0 | ||
enableMultiView = 0 | ||
depthClipEnable = 1 | ||
rasterizerDiscardEnable = 0 | ||
perSampleShading = 1 | ||
numSamples = 8 | ||
samplePatternIdx = 48 | ||
usrClipPlaneMask = 0 | ||
includeDisassembly = 0 | ||
alphaToCoverageEnable = 0 | ||
dualSourceBlendEnable = 1 | ||
colorBuffer[0].format = VK_FORMAT_R32G32B32A32_SFLOAT | ||
colorBuffer[0].channelWriteMask = 15 | ||
colorBuffer[0].blendEnable = 1 | ||
colorBuffer[0].blendSrcAlphaToColor = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.