''register(ID, space)'' like register(t3, space1) will be translated into
i32 3, i32 1 as the last 2 operands for resource annotation metadata.
NamedMetadata for CBuffers and SRVs are added as "hlsl.srvs" and "hlsl.cbufs".
Paths
| Differential D130951
[HLSL] CodeGen hlsl resource binding. ClosedPublic Authored by python3kgae on Aug 1 2022, 4:42 PM.
Details Summary ''register(ID, space)'' like register(t3, space1) will be translated into NamedMetadata for CBuffers and SRVs are added as "hlsl.srvs" and "hlsl.cbufs".
Diff Detail
Event Timelinepython3kgae added a parent revision: D130131: [HLSL] CodeGen hlsl cbuffer/tbuffer..Aug 1 2022, 5:01 PM
python3kgae marked an inline comment as done. Comment ActionsRename ResBinding and addResourceAnnotation to BufferResBinding and addBufferResourceAnnotation.
python3kgae added a child revision: D131370: [DirectX backend] Translate cbuffer into DXIL..Aug 8 2022, 1:42 PM python3kgae removed a parent revision: D130131: [HLSL] CodeGen hlsl cbuffer/tbuffer..Oct 12 2022, 9:23 PM Comment Actions Add resource shape to metadata.
python3kgae added a child revision: D136031: [DirectX backend] support ConstantBuffer to DXILResource.h.Oct 15 2022, 7:34 PM
This revision is now accepted and ready to land.Oct 17 2022, 2:20 PM
Closed by commit rG13163dd8abc5: [HLSL] CodeGen hlsl resource binding. (authored by python3kgae). · Explain WhyOct 17 2022, 2:29 PM This revision was automatically updated to reflect the committed changes. python3kgae removed a child revision: D136031: [DirectX backend] support ConstantBuffer to DXILResource.h.Dec 13 2022, 12:56 PM
Revision Contents
Diff 468329 clang/lib/CodeGen/CGHLSLRuntime.h
clang/lib/CodeGen/CGHLSLRuntime.cpp
clang/test/CodeGenHLSL/builtins/RWBuffer-annotations.hlsl
clang/test/CodeGenHLSL/cbuf.hlsl
llvm/include/llvm/Frontend/HLSL/HLSLResource.h
llvm/lib/Frontend/HLSL/HLSLResource.cpp
llvm/lib/Target/DirectX/DXILResource.h
llvm/lib/Target/DirectX/DXILResource.cpp
llvm/test/CodeGen/DirectX/UAVMetadata.ll
|
Does this apply to buffers only? In which case it might be better to either nest this into Buffer definition or rename into something like BufferResBinding. Also adding some documenting comments would help here, even if they could just refer to the language documentation.