summaryrefslogtreecommitdiff
path: root/llvm/lib/Object/DXContainer.cpp
AgeCommit message (Collapse)Author
2025-05-29[DirectX] Adding support for static samplers in yaml2obj/obj2yaml (#139963)joaosaffran
- Adds support for static samplers ins dxcontainer binary format. - Adds writing logic to mcdxbc - adds reading logic to Object - adds tests Closes: [126636](https://github.com/llvm/llvm-project/issues/126636) --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-05-27[NFC] Updating RTS0 namespace to contain all elements related to it's ↵joaosaffran
representation (#141173) As requested in a previous PR, this change moves all structs related to RTS0 to RTS0 namespace. --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-04-16[DirectX] adding support in obj2yaml and yaml2obj to root constants (#127840)joaosaffran
Adding support for Root Constant in MC, Object and obj2yaml and yaml2obj, this PR adds: - new structures to dxbc definition. - serialize and desirialize logic from dxcontainer to yaml - tests validating against dxc - adding support to multiple parts. Closes: https://github.com/llvm/llvm-project/issues/126633 --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-02-13[DXIL] Add support for root signature flag element in DXContainer (#123147)joaosaffran
Adding support for Root Signature Flags Element extraction and writing to DXContainer. - Adding an analysis to deal with RootSignature metadata definition - Adding validation for Flag - writing RootSignature blob into DXIL Closes: [126632](https://github.com/llvm/llvm-project/issues/126632) --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-02-07[DXIL] Adding support to RootSignatureFlags in obj2yaml (#122396)joaosaffran
This PR adds: - `RootSignatureFlags` extraction from DXContainer using `obj2yaml` This PR is part of: #121493 --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2024-03-25Add support for PSV EntryFunctionName (#86296)Cooper Partin
This change introduces a version 3 of the PSV data that includes support for the name of the entry function as an offset into StringTable data to a null-terminated utf-8 string. Additional tests were added to ensure that the new value was properly serialized/deserialized from object data. Fixes #80175 --------- Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
2024-03-21Revert "Add support for PSV EntryFunctionName (#84409)" (#86211)Cooper Partin
This reverts commit cde54df39cab3a1d60a3e1862ab341609bee3cc3. Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
2024-03-21Add support for PSV EntryFunctionName (#84409)Cooper Partin
This change introduces a version 3 of the PSV data that includes support for the name of the entry function as an offset into StringTable data to a null-terminated utf-8 string. Additional tests were added to ensure that the new value was properly serialized/deserialized from object data. Fixes #80175 --------- Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
2024-02-27[DirectX][NFC] Rename ShaderFlag to SHADER_FEATURE_FLAG. (#82700)Xiang Li
This is preparation for add ShaderFlag in DXIL. For #57925
2024-01-25[llvm] Silence warning when compiling with MSVC targetting x86Alexandre Ganea
This fixes: ``` [1265/6998] Building CXX object lib\Object\CMakeFiles\LLVMObject.dir\DXContainer.cpp.obj C:\git\llvm-project\llvm\lib\Object\DXContainer.cpp(344): warning C4018: '<': signed/unsigned mismatch ```
2023-12-15[Object] Drop unnecessary const qualifier to fix gcc Wignored-qualifiers ↵Simon Pilgrim
warning. NFC.
2023-10-05[DX] Add support for program signatures (#67346)Chris B
For DirectX, program signatures are encoded into three different binary sections depending on if the signature is for inputs, outputs, or patches. All three signature types use the same data structure encoding so they can share a lot of logic. This patch adds support for reading and writing program signature data as both yaml and binary data. Fixes #57743 and #57744
2023-09-15[DX] Support pipeline state masks (#66425)Chris B
The DXContainer pipeline state information encodes a bunch of mask vectors that are used to track things about the inputs and outputs from each shader. This adds support for reading and writing them throught he YAML test interfaces. The writing logic in MC is extremely primitive and we'll want to revisit the API for that, but since I'm not sure how we'll want to generate the mask bits from DXIL during code generation I didn't want to spend too much time on the API. Fixes #59479
2023-08-16Re-land [DX] Add support for PSV signature elementsChris Bieneman
The pipeline state data captured in the PSV0 section of the DXContainer file encodes signature elements which are read by the runtime to map inputs and outputs from the GPU program. This change adds support for generating and parsing signature elements with testing driven through the ObjectYAML tooling. Reviewed By: bogner Differential Revision: https://reviews.llvm.org/D157671 Initially landed as 8c567e64f808f7a818965c6bc123fedf7db7336f, and reverted in 4d800633b2683304a5431d002d8ffc40a1815520. ../llvm/include/llvm/BinaryFormat/DXContainerConstants.def ../llvm/test/ObjectYAML/DXContainer/PSVv1-amplification.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-compute.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-domain.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-geometry.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-vertex.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-amplification.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-compute.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-domain.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-geometry.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-vertex.yaml
2023-08-16Revert "[DX] Add support for PSV signature elements"Chris Bieneman
This reverts commit 8c567e64f808f7a818965c6bc123fedf7db7336f.
2023-08-16[DX] Add support for PSV signature elementsChris Bieneman
The pipeline state data captured in the PSV0 section of the DXContainer file encodes signature elements which are read by the runtime to map inputs and outputs from the GPU program. This change adds support for generating and parsing signature elements with testing driven through the ObjectYAML tooling. Reviewed By: bogner Differential Revision: https://reviews.llvm.org/D157671
2023-07-19[DX] Fix PSV resource serializationChris Bieneman
When writing this initially I missed including the resource stride. This change adds the resources stride to the serialized value. I've also extended the testing and error reporting around parsing PSV information. This adds tests to verify that the reader produces meaningful error messages for malformed DXContainer files, and a test that verifies the resource stride is respected in the reader even if the stride isn't an expected or known value (as would happen if the format changes in the future). This is part of #59479. Reviewed By: bogner, bob80905 Differential Revision: https://reviews.llvm.org/D155143
2023-02-02[DX] Add support for PSV resource bindingsChris Bieneman
This patch continues implementing DirectX pipeline state validation information by adding support for resource binding metadata. Reviewed By: python3kgae Differential Revision: https://reviews.llvm.org/D143130
2023-02-01[DX] Begin adding support for pipeline stateChris Bieneman
DirectX shader pipeline state validation information is a fairly complicated to serialize data structure. This patch adds the first bit of support for reading and writing the runtime info structure which comes first in the encoded data. Subsequent patches will flesh out the remaining fields of the data structure. There is no official documentation for the format, but the format is roughly documented in the code comment here: https://github.com/microsoft/DirectXShaderCompiler/blob/main/include/dxc /DxilContainer/DxilPipelineStateValidation.h#L731 Reviewed By: python3kgae Differential Revision: https://reviews.llvm.org/D141649
2023-01-03[DX] Improve parse error messagesChris Bieneman
This change refactors the parte parsing logic to operate on StringRefs of the part data rather than starting from an offset and splicing down. It also improves some of the error reporting around part layout. Specifically, this code now reports a distinct error if there isn't enough data in the buffer to store the part size and it reports an error if the parts overlap. Reviewed By: bob80905 Differential Revision: https://reviews.llvm.org/D139681
2022-11-08Reland "[llvm][NFC] Use c++17 style variable type traits"Nathan James
This reverts commit 632a389f96355cbe7ed8fa7b8d2ed6267c92457c. This relands commit 1834a310d060d55748ca38d4ae0482864c2047d8. Differential Revision: https://reviews.llvm.org/D137493
2022-11-08Revert "[llvm][NFC] Use c++17 style variable type traits"Nathan James
This reverts commit 1834a310d060d55748ca38d4ae0482864c2047d8.
2022-11-08[llvm][NFC] Use c++17 style variable type traitsNathan James
This was done as a test for D137302 and it makes sense to push these changes Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D137493
2022-10-27[ObjectYAML] Add support for DXContainer HASHChris Bieneman
DXContainer files contain a part that has an MD5 of the generated shader. This adds support to the ObjectYAML tooling to expand the hash part data and hash iteself in preparation for adding hashing support to DirectX code generation. Reviewed By: python3kgae Differential Revision: https://reviews.llvm.org/D136632
2022-09-29[DX] [ObjectYAML] Support DX shader feature flagsChris Bieneman
DXContainers contain a feature flag part, which stores a bitfield used to denote what underlying hardware features the shader requires. This change adds feature flags to the DXContainer YAML tooling to enable testing generating feature flags during HLSL code generation. Depends on D133980 Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D134315
2022-09-29[NFC] Refactor DXContainer to support more partsChris Bieneman
This patch refactors some of the DXContainer Object and YAML code to make it easier to add more part parsing. DXContainer has a whole bunch of constant values, so I've added a DXContainerConstants.def file which will grow with constant definitions, but starts with just part identifiers. I've also added a utility to parse the part magic string into an enum, and converted the code to use that utility and the enum instead of the part literal string. Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D133980
2022-06-06[DX][ObjYAML] Support for parsing DXIL partChris Bieneman
This patch adds support for parsing the DXIL part data into the ObjectYAML tooling. The DXIL part has additional headers describing the shader and bitcode data and stores serialized bitcode after the headers. Depends on D124945 Reviewed By: kuhar Differential Revision: https://reviews.llvm.org/D126795
2022-06-06[ObjectYAML][DX] Add dxcontainer2yaml supportChris Bieneman
This change finishes fleshing out the ObjectYAML tools to support converting DXContainer files into yaml representations. Depends on D124944 Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D124945
2022-06-06Fix overflow bug impacting 32-bit testingChris Bieneman
This test was failing on 32-bit arm builders due to an interger overflow. This changes the math to avoid overflow and should resolve the test failure.
2022-06-01[Object][DX] Parse DXContainer PartsChris Bieneman
DXContainer files are structured as parts. This patch adds support for parsing out the file part offsets and file part headers. Reviewed By: kuhar Differential Revision: https://reviews.llvm.org/D124804
2022-05-18[NFC] correcting a code comment.Chris Bieneman
2022-05-02[NFC] Fixing error on some versions of GCCChris Bieneman
Some versions of GCC don't implicitly move Error to Expected.
2022-05-02[Object][DX] Initial DXContainer parsing supportChris Bieneman
This patch begins adding DXContainer parsing support to libObject. Following the pattern used by ELFFile my goal here is to write a standalone DXContainer parser and later write an adapter interface to support a subset of the ObjectFile interfaces so that we can add limited objdump support. I will also be adding ObjectYAML support to help drive testing of the object tools and MC-level object writers as those come together. DXContainer is a slightly odd format. It is arranged in "parts" that are semantically similar to sections, but it doesn't support symbol listing. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D124643