17 Commits

Author SHA1 Message Date
joaosaffran
c21e2a5e24
[DirectX] Moving Root Signature Metadata Parsing in to Shared Root Signature Metadata lib (#149221)
This PR, moves the existing Root Signature Metadata Parsing logic used
in `DXILRootSignature` to the common library used by both frontend and
backend. Closes:
[#145942](https://github.com/llvm/llvm-project/issues/145942)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-07-23 17:03:13 -07:00
joaosaffran
ca888f085c
[DirectX][NFC] Refactor DXILRootSignature to follow the same pattern as other analysis (#146783)
When implementing #146785, notice `DXILRootSignature` had some design
changes that made it harder to integrate with other analysis. This
change refactors `DXILRootSignature` to solve this issue.
---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-07-10 10:31:40 -07:00
Finn Plummer
420e2f584d
[DirectX] Add missing verifications during validate of DXILRootSignature (#147111)
This pr resolves some discrepancies in verification during `validate` in
`DXILRootSignature.cpp`.

Note: we don't add a backend test for version 1.0 flag values because it
treats the struct as though there is no flags value. However, this will
be used when we use the verifications in the frontend.

- Updates `verifyDescriptorFlag` to check for valid flags based on
version, as reflected [here](https://github.com/llvm/wg-hlsl/pull/297)
- Add test to demonstrate updated flag verifications
- Adds `verifyNumDescriptors` to the validation of `DescriptorRange`s
- Add a test to demonstrate `numDescriptors` verification
- Updates a number of tests that mistakenly had an invalid
`numDescriptors` specified

Resolves: https://github.com/llvm/llvm-project/issues/147107
2025-07-09 12:02:02 -07:00
Finn Plummer
deba201f70
[NFC][HLSL][DirectX] Move DXILRootSignature validations to RootSignatureValidations library (#147110)
Simple code movement of the verification logic in `validate` of the
`DXILRootSignature` pass.

Moving this code to the `RootSignatureValidations` library allows for
the common verifications to be used in the frontend.

- Moves all the `static` verification functions used in
`DXILRootSignature` to the `RootSignatureValidations` library
- Updates `DXILRootSignature` to use the moved functions

Resolves: https://github.com/llvm/llvm-project/issues/145940
2025-07-07 15:25:08 -07:00
Finn Plummer
0ceb0c377a
[NFC][HLSL][DirectX] Let HLSLRootSignature reuse the dxbc defined enums (#145986)
This pr removes the redundancy of having the same enums defined in both
the front-end and back-end of handling root signatures. Since there are
many more uses of the enum in the front-end of the code, we will adhere
to the naming conventions used in the front-end, to minimize the diff.

The macros in `DXContainerConstants.def` are also touched-up to be
consistent and to have each macro name follow its respective definition
in d3d12.h and searchable by name
[here](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/).

Additionally, the many `getEnumNames` are moved to `DXContainer` from
`HLSLRootSignatureUtils` as they we will want them to be exposed
publicly anyways.

Changes for each enum follow the pattern of a commit that will make the
enum definition in `DXContainer` adhere to above listed naming
conventions, followed by a commit to actually use that enum in the
front-end.

Resolves https://github.com/llvm/llvm-project/issues/145815
2025-07-03 14:44:11 -07:00
joaosaffran
171aa34e43
[DirectX] Add static sampler support to root signature (#143422)
Implements static samplers parsing from root signature metadata
representation. This is required to support Root Signatures in HLSL.
Closes: #[126641](https://github.com/llvm/llvm-project/issues/126641)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-06-27 14:30:48 -07:00
Justin Bogner
6b9fe9e0bc
[HLSL] Emit a version in the dx.rootsignatures metadata (#145113)
In #144957 the backend was updated to expect a version in the metadata,
but since the frontend wasn't updated this breaks compilation. This is a
somewhat temporary fix to that until #144813 lands.
2025-06-20 16:21:47 -07:00
joaosaffran
b5d5708128
[HLSL] Add descriptor table metadata parsing (#142492)
Implements descriptor table parsing from root signature metadata. This
is required to support root signatures in hlsl.
Closes: #[126640](https://github.com/llvm/llvm-project/issues/126640)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-06-20 12:12:02 -07:00
joaosaffran
fa7646008e
[DirectX] Add Root Signature Version Support and Update Test IR Format (#144957)
Updates the Root Signature metadata parser to extract version
information. This requirement was added after the initial parser
implementation.

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-06-19 17:39:48 -07:00
joaosaffran
ad6575f2da
[HLSL] Adding support for root descriptors in root signature metadata representation (#139781)
- adds parsing from metadata into dxcontainer binary
- adds validations as described in the spec
- adds testing scenarios
closes: [#126638](https://github.com/llvm/llvm-project/issues/126638)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-06-04 11:21:22 -07:00
joaosaffran
654c4bc286
[NFC] Updating RTS0 namespace to contain all elements related to it's 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-05-27 16:46:01 -07:00
joaosaffran
8d63afbe5c
[NFC] Refactoring MCDXBC to support out of order storage of root parameters (#137284)
This PR refactors mcdxbc data structure for root signatures to support
out of order storage of in memory root signature data.
closes: #139585

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-05-15 18:33:15 -07:00
joaosaffran
b649b3557e
[HLSL] Adding support for Root Constants in LLVM Metadata (#135085)
- Closes [#126637](https://github.com/llvm/llvm-project/issues/126637)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-04-24 13:56:34 -07:00
joaosaffran
53eae22e22
[DirectX] adding support in obj2yaml and yaml2obj to root constants (#127840)
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-04-16 18:38:53 -07:00
joaosaffran
936fe9bb5c
[HLSL] Add more tests to root signature metadata extraction (#127283)
This PR adds a few more tests to validate some error scenarios of root
signature metadata representation.

Closes: https://github.com/llvm/llvm-project/issues/127280

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-02-18 11:40:29 -08:00
joaosaffran
77ddffc946
[HLSL] Fix Root signature test error (#127261)
Fixing error detected in build bot in file
`RootSignature-MultipleEntryFunctions.ll`

closes: [127260](https://github.com/llvm/llvm-project/issues/127260)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-02-14 15:39:52 -08:00
joaosaffran
1ff5f328d9
[DXIL] Add support for root signature flag element in DXContainer (#123147)
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-13 14:16:01 -08:00