Skip to content

Commit 09b57d9

Browse files
committed
[𝘀𝗽𝗿] changes to main this commit is based on
Created using spr 1.3.5-bogner [skip ci]
1 parent 13a6a79 commit 09b57d9

36 files changed

+1350
-535
lines changed

llvm/docs/DirectX/DXILOpTableGenDesign.rst

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,14 @@ properties are specified as fields of the ``DXILOp`` class as described below.
9393
class DXILOpClass;
9494
9595
Concrete operation records, such as ``unary`` are defined by inheriting from ``DXILOpClass``.
96-
6. Return type of the operation is represented as ``LLVMType``.
97-
7. Operation arguments are represented as a list of ``LLVMType`` with each type
98-
corresponding to the argument position. An overload type, if supported by the operation, is
99-
denoted as the positional type ``overloadTy`` in the argument or in the result, where
100-
``overloadTy`` is defined to be synonymous to ``llvm_any_ty``.
101-
102-
.. code-block::
103-
104-
defvar overloadTy = llvm_any_ty
105-
106-
Empty list, ``[]`` represents an operation with no arguments.
107-
96+
6. A set of type names are defined that represent return and argument types,
97+
which all inherit from ``DXILOpParamType``. These represent simple types
98+
like ``int32Ty``, DXIL types like ``dx.types.Handle``, and a special
99+
``overloadTy`` which can be any type allowed by ``Overloads``, described
100+
below.
101+
7. Operation return type is represented as a ``DXILOpParamType``, and arguments
102+
are represented as a list of the same. An operation with no return value
103+
shall specify ``VoidTy`` as its return.
108104
8. Valid operation overload types predicated on DXIL version are specified as
109105
a list of ``Overloads`` records. Representation of ``Overloads``
110106
class is described in a later section.
@@ -145,10 +141,10 @@ TableGen representations of its properties described above.
145141
Intrinsic LLVMIntrinsic = ?;
146142
147143
// Result type of the op.
148-
LLVMType result;
144+
DXILOpParamType result;
149145
150146
// List of argument types of the op. Default to 0 arguments.
151-
list<LLVMType> arguments = [];
147+
list<DXILOpParamType> arguments = [];
152148
153149
// List of valid overload types predicated by DXIL version
154150
list<Overloads> overloads;
@@ -233,9 +229,9 @@ overloads predicated on DXIL version as list of records of the following class
233229

234230
.. code-block::
235231
236-
class Overloads<Version minver, list<LLVMType> ols> {
232+
class Overloads<Version minver, list<DXILOpParamType> ols> {
237233
Version dxil_version = minver;
238-
list<LLVMType> overload_types = ols;
234+
list<DXILOpParamType> overload_types = ols;
239235
}
240236
241237
Following is an example specification of valid overload types for ``DXIL1_0`` and

llvm/docs/DirectX/DXILResources.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ the subsequent ``dx.op.annotateHandle`` operation in. Note that we don't have
162162
an analogue for `dx.op.createHandle`_, since ``dx.op.createHandleFromBinding``
163163
subsumes it.
164164

165+
For simplicity of lowering, We match DXIL in using an index from the beginning
166+
of the binding space rather than an index from the lower bound of the binding
167+
itself.
168+
165169
.. _dx.op.createHandle: https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#resource-handles
166170

167171
.. list-table:: ``@llvm.dx.handle.fromBinding``
@@ -190,7 +194,7 @@ subsumes it.
190194
* - ``%index``
191195
- 4
192196
- ``i32``
193-
- Index of the resource to access.
197+
- Index from the beginning of the binding space to access.
194198
* - ``%non-uniform``
195199
- 5
196200
- i1
@@ -365,11 +369,11 @@ Examples:
365369

366370
.. code-block:: llvm
367371
368-
call void @llvm.dx.bufferStore.tdx.Buffer_f32_1_0t(
372+
call void @llvm.dx.typedBufferStore.tdx.Buffer_v4f32_1_0_0t(
369373
target("dx.TypedBuffer", f32, 1, 0) %buf, i32 %index, <4 x f32> %data)
370-
call void @llvm.dx.bufferStore.tdx.Buffer_f16_1_0t(
374+
call void @llvm.dx.typedBufferStore.tdx.Buffer_v4f16_1_0_0t(
371375
target("dx.TypedBuffer", f16, 1, 0) %buf, i32 %index, <4 x f16> %data)
372-
call void @llvm.dx.bufferStore.tdx.Buffer_f64_1_0t(
376+
call void @llvm.dx.typedBufferStore.tdx.Buffer_v2f64_1_0_0t(
373377
target("dx.TypedBuffer", f64, 1, 0) %buf, i32 %index, <2 x f64> %data)
374378
375379
.. list-table:: ``@llvm.dx.rawBufferPtr``

llvm/include/llvm/Analysis/DXILResource.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class TargetExtType;
2323
namespace dxil {
2424

2525
class ResourceInfo {
26+
public:
2627
struct ResourceBinding {
2728
uint32_t RecordID;
2829
uint32_t Space;
@@ -89,6 +90,7 @@ class ResourceInfo {
8990
bool operator!=(const FeedbackInfo &RHS) const { return !(*this == RHS); }
9091
};
9192

93+
private:
9294
// Universal properties.
9395
Value *Symbol;
9496
StringRef Name;
@@ -115,6 +117,10 @@ class ResourceInfo {
115117

116118
MSInfo MultiSample;
117119

120+
// We need a default constructor if we want to insert this in a MapVector.
121+
ResourceInfo() {}
122+
friend class MapVector<CallInst *, ResourceInfo>;
123+
118124
public:
119125
ResourceInfo(dxil::ResourceClass RC, dxil::ResourceKind Kind, Value *Symbol,
120126
StringRef Name)
@@ -166,6 +172,8 @@ class ResourceInfo {
166172
MultiSample.Count = Count;
167173
}
168174

175+
dxil::ResourceClass getResourceClass() const { return RC; }
176+
169177
bool operator==(const ResourceInfo &RHS) const;
170178

171179
static ResourceInfo SRV(Value *Symbol, StringRef Name,

llvm/include/llvm/IR/IntrinsicsDirectX.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ def int_dx_handle_fromBinding
3030
[llvm_i32_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty, llvm_i1_ty],
3131
[IntrNoMem]>;
3232

33+
def int_dx_typedBufferLoad
34+
: DefaultAttrsIntrinsic<[llvm_anyvector_ty], [llvm_any_ty, llvm_i32_ty]>;
35+
def int_dx_typedBufferStore
36+
: DefaultAttrsIntrinsic<[], [llvm_any_ty, llvm_i32_ty, llvm_anyvector_ty]>;
37+
38+
// Cast between target extension handle types and dxil-style opaque handles
39+
def int_dx_cast_handle : Intrinsic<[llvm_any_ty], [llvm_any_ty]>;
40+
3341
def int_dx_all : DefaultAttrsIntrinsic<[llvm_i1_ty], [llvm_any_ty]>;
3442
def int_dx_any : DefaultAttrsIntrinsic<[llvm_i1_ty], [llvm_any_ty]>;
3543
def int_dx_clamp : DefaultAttrsIntrinsic<[llvm_any_ty], [LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>]>;

llvm/include/llvm/Support/DXILABI.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,6 @@
2222
namespace llvm {
2323
namespace dxil {
2424

25-
enum class ParameterKind : uint8_t {
26-
Invalid = 0,
27-
Void,
28-
Half,
29-
Float,
30-
Double,
31-
I1,
32-
I8,
33-
I16,
34-
I32,
35-
I64,
36-
Overload,
37-
CBufferRet,
38-
ResourceRet,
39-
DXILHandle,
40-
};
41-
4225
enum class ResourceClass : uint8_t {
4326
SRV = 0,
4427
UAV,

0 commit comments

Comments
 (0)