14 Commits

Author SHA1 Message Date
Justin Bogner
34e20f18f0
[DirectX] Implement typedBufferLoad_checkbit (#108087)
This represents a typedBufferLoad that's followed by
"CheckAccessFullyMapped". It returns an extra `i1` representing that
value.

Fixes #108085
2024-09-11 16:24:38 -07:00
Justin Bogner
90e841131a
[DirectX] Lower @llvm.dx.typedBufferStore to DXIL ops
The `@llvm.dx.typedBufferStore` intrinsic is lowered to `@dx.op.bufferStore`.

Pull Request: https://github.com/llvm/llvm-project/pull/104253
2024-09-10 10:33:57 -07:00
Justin Bogner
3f22756f39
[DirectX] Lower @llvm.dx.typedBufferLoad to DXIL ops
The `@llvm.dx.typedBufferLoad` intrinsic is lowered to `@dx.op.bufferLoad`.
There's some complexity here in translating to scalarized IR, which I've
abstracted out into a function that should be useful for samples, gathers, and
CBuffer loads.

I've also updated the DXILResources.rst docs to match what I'm doing here and
the proposal in llvm/wg-hlsl#59. I've removed the content about stores and raw
buffers for now with the expectation that it will be added along with the work.

Note that this change includes a bit of a hack in how it deals with
`getOverloadKind` for the `dx.ResRet` types - we need to adjust how we deal
with operation overloads to generate a table directly rather than proxy through
the OverloadKind enum, but that's left for a later change here.

Part of #91367

Pull Request: https://github.com/llvm/llvm-project/pull/104252
2024-09-09 13:21:22 -07:00
Justin Bogner
aa61925eac
[DirectX] Lower @llvm.dx.handle.fromBinding to DXIL ops
The `@llvm.dx.handle.fromBinding` intrinsic is lowered either to the
`CreateHandle` op or a pair of `CreateHandleFromBinding` and `AnnotateHandle`
ops, depending on the DXIL version. Regardless of the DXIL version we need to
emit metadata about the binding, but that's left to a separate change.

These DXIL ops all need to return the `%dx.types.Handle` type, but the llvm
intrinsic returns a target extension type. To facilitate changing the type of
the operation and all of its users, we introduce `%llvm.dx.cast.handle`, which
can cast between the two handle representations.

Pull Request: https://github.com/llvm/llvm-project/pull/104251
2024-08-23 12:58:12 -07:00
Justin Bogner
f357fe371d
[DirectX] Disentangle DXIL.td's op types from LLVMType. NFC
LLVMType is both too broad and too narrow for defining DXIL operations, in
different ways. It's too broad in the sense that we don't need the full set of
MVTs - the set of types DXIL operations work on is much smaller. It's too
narrow in the sense that it's difficult to use it for the various fixed
structure types in DXIL, like `%dx.types.Handle` or `%dx.Types.ResRet.f32`.

Replace the usage of LLVMType in DXIL.td with DXILOpParamType, a simple class
that we can define an enum of types from. Further, use this to replace the
"ParameterKind" enum in DXILABI.h that has nothing to do with DXIL's ABI.

Pull Request: https://github.com/llvm/llvm-project/pull/104247
2024-08-19 10:09:46 -07:00
Justin Bogner
135a1e90a3
[DirectX] Update "dx.TypedBuffer" docs to include a "signed" bit (#100695)
To lower these types to dxil we need to know whether ints are signed or
not, but the LLVM type loses that. Add a bit to indicate it's so.
2024-07-29 09:59:05 -07:00
S. Bharadwaj Yadavalli
6777c34007
[DXIL][Doc] Update specification of TableGen DXIL properties (#99055)
Update the specification of various DXIL Operation properties that
are predicated by DXIL version.
2024-07-22 16:23:27 -04:00
Justin Bogner
9be5f4f5d5
[DirectX] Start documenting DXIL Resource handling (#90553)
This adds a new document about DXIL Resource Handling. I've attempted to
describe here how we intend to use TargetExtTypes to represent resources
in LLVM IR and the various intrinsics we'll need to lower these through
LLVM to DXIL.

For now this document is limited to the high level concepts and a few
details on buffer types, and there are a number of TODOs in the document
that we'll iterate on as we progress in the implementation.
2024-07-16 13:42:55 -07:00
S. Bharadwaj Yadavalli
d85706198b
[DirectX][DXIL] Update DXIL Op TableGen Specification (#95807)
Add a mechanism to specify constraints to the design document. These facilitate
specification of DXIL Op attributes that are predicated by Shader Model version.
2024-06-19 14:41:28 -04:00
S. Bharadwaj Yadavalli
495bc3cf23
[DirectX][DXIL] Design document for TableGen Spec of DXIL Operations (#85170)
Add an initial design document for TableGen specification of DXIL Operations.
2024-05-29 16:58:13 -04:00
Chris B
afeedd9c3d
[DirectX][docs] Document DXContainer format (#90908)
This adds a document to describe the DXContainer format and the
structures of data inside the file.

Resolves #88775
2024-05-06 16:20:31 -05:00
Farzon Lotfi
d51f1c442b
[DirectX][Docs] Add DXILIntrinsicExpansion Pass to DXILArchitecture.rst (#86198)
Completes #84839

---------

Co-authored-by: Farzon Lotfi <farzon@farzon.com>
2024-03-22 08:14:26 -04:00
Chris B
2e0ddfc163
[DirectX][docs] Expand DXILArchitecture documentation (#84077)
This just seeks to give a high level overview of the current state of
the DirectX backend. It doesn't go in too deep, but should be a starting
point for further documentation.

---------

Co-authored-by: S. Bharadwaj Yadavalli <Bharadwaj.Yadavalli@microsoft.com>
2024-03-08 11:44:31 -06:00
Justin Bogner
151559cfe4
[DirectX][docs] Architecture and design philosophy of DXIL support
This documents some of the architectural direction for DXIL and tries
to provide a bit of a map for where to implement different aspects of
DXIL support.

Pull Request: https://github.com/llvm/llvm-project/pull/78221
2024-01-31 10:17:19 -08:00