@@ -268,18 +268,29 @@ def miss : DXILShaderStage;
268
268
def all_stages : DXILShaderStage;
269
269
// Denote support for DXIL Op to have been removed
270
270
def removed : DXILShaderStage;
271
+
271
272
// DXIL Op attributes
272
273
274
+ // A function attribute denotes that there is a corresponding LLVM function
275
+ // attribute that will be set when building the DXIL op. The mapping is defined
276
+ // by setDXILAttributes in DXILOpBuilder.cpp
273
277
class DXILAttribute;
274
278
275
- def ReadOnly : DXILAttribute;
276
279
def ReadNone : DXILAttribute;
277
- def IsDerivative : DXILAttribute;
278
- def IsGradient : DXILAttribute;
279
- def IsFeedback : DXILAttribute;
280
- def IsWave : DXILAttribute;
281
- def NeedsUniformInputs : DXILAttribute;
282
- def IsBarrier : DXILAttribute;
280
+ def ReadOnly : DXILAttribute;
281
+ def NoDuplicate : DXILAttribute;
282
+ def NoReturn : DXILAttribute;
283
+
284
+ // A property is simply used to mark that a DXIL op belongs to a sub-group of
285
+ // DXIL ops, and it is used to query if a particular op holds this property.
286
+ // This is used for the static analysis of DXIL ops.
287
+ class DXILProperty;
288
+
289
+ def IsBarrier : DXILProperty;
290
+ def IsGradient : DXILProperty;
291
+ def IsFeedback : DXILProperty;
292
+ def IsWave : DXILProperty;
293
+ def RequiresUniformInputs : DXILProperty;
283
294
284
295
class Overloads<Version ver, list<DXILOpParamType> ols> {
285
296
Version dxil_version = ver;
@@ -293,7 +304,7 @@ class Stages<Version ver, list<DXILShaderStage> st> {
293
304
294
305
class Attributes<Version ver = DXIL1_0, list<DXILAttribute> attrs> {
295
306
Version dxil_version = ver;
296
- list<DXILAttribute> op_attrs = attrs;
307
+ list<DXILAttribute> fn_attrs = attrs;
297
308
}
298
309
299
310
defvar BarrierMode_DeviceMemoryBarrier = 2;
@@ -386,6 +397,9 @@ class DXILOp<int opcode, DXILOpClass opclass> {
386
397
387
398
// Versioned attributes of operation
388
399
list<Attributes> attributes = [];
400
+
401
+ // List of properties. Default to no properties.
402
+ list<DXILProperty> properties = [];
389
403
}
390
404
391
405
// Concrete definitions of DXIL Operations
@@ -805,6 +819,10 @@ def CreateHandle : DXILOp<57, createHandle> {
805
819
let arguments = [Int8Ty, Int32Ty, Int32Ty, Int1Ty];
806
820
let result = HandleTy;
807
821
let stages = [Stages<DXIL1_0, [all_stages]>, Stages<DXIL1_6, [removed]>];
822
+ // NOTE: The ReadOnly attribute was set for consistency with DXC. However, it
823
+ // seems like ReadNone may more appropiately describe it. So noted to
824
+ // consider a change in the future
825
+ let attributes = [Attributes<DXIL1_0, [ReadOnly]>];
808
826
}
809
827
810
828
def BufferLoad : DXILOp<68, bufferLoad> {
@@ -816,6 +834,7 @@ def BufferLoad : DXILOp<68, bufferLoad> {
816
834
[Overloads<DXIL1_0,
817
835
[ResRetHalfTy, ResRetFloatTy, ResRetInt16Ty, ResRetInt32Ty]>];
818
836
let stages = [Stages<DXIL1_0, [all_stages]>];
837
+ let attributes = [Attributes<DXIL1_0, [ReadOnly]>];
819
838
}
820
839
821
840
def BufferStore : DXILOp<69, bufferStore> {
@@ -844,6 +863,7 @@ def CheckAccessFullyMapped : DXILOp<71, checkAccessFullyMapped> {
844
863
let result = Int1Ty;
845
864
let overloads = [Overloads<DXIL1_0, [Int32Ty]>];
846
865
let stages = [Stages<DXIL1_0, [all_stages]>];
866
+ let attributes = [Attributes<DXIL1_0, [ReadOnly]>];
847
867
}
848
868
849
869
def Discard : DXILOp<82, discard> {
@@ -955,8 +975,8 @@ def Dot4AddI8Packed : DXILOp<163, dot4AddPacked> {
955
975
let intrinsics = [ IntrinSelect<int_dx_dot4add_i8packed> ];
956
976
let arguments = [Int32Ty, Int32Ty, Int32Ty];
957
977
let result = Int32Ty;
958
- let attributes = [Attributes<DXIL1_0, [ReadNone]>];
959
978
let stages = [Stages<DXIL1_0, [all_stages]>];
979
+ let attributes = [Attributes<DXIL1_0, [ReadNone]>];
960
980
}
961
981
962
982
def Dot4AddU8Packed : DXILOp<164, dot4AddPacked> {
@@ -965,22 +985,24 @@ def Dot4AddU8Packed : DXILOp<164, dot4AddPacked> {
965
985
let intrinsics = [ IntrinSelect<int_dx_dot4add_u8packed> ];
966
986
let arguments = [Int32Ty, Int32Ty, Int32Ty];
967
987
let result = Int32Ty;
968
- let attributes = [Attributes<DXIL1_0, [ReadNone]>];
969
988
let stages = [Stages<DXIL1_0, [all_stages]>];
989
+ let attributes = [Attributes<DXIL1_0, [ReadNone]>];
970
990
}
971
991
972
992
def AnnotateHandle : DXILOp<216, annotateHandle> {
973
993
let Doc = "annotate handle with resource properties";
974
994
let arguments = [HandleTy, ResPropsTy];
975
995
let result = HandleTy;
976
996
let stages = [Stages<DXIL1_6, [all_stages]>];
997
+ let attributes = [Attributes<DXIL1_0, [ReadNone]>];
977
998
}
978
999
979
1000
def CreateHandleFromBinding : DXILOp<217, createHandleFromBinding> {
980
1001
let Doc = "create resource handle from binding";
981
1002
let arguments = [ResBindTy, Int32Ty, Int1Ty];
982
1003
let result = HandleTy;
983
1004
let stages = [Stages<DXIL1_6, [all_stages]>];
1005
+ let attributes = [Attributes<DXIL1_0, [ReadNone]>];
984
1006
}
985
1007
986
1008
def WaveActiveAllTrue : DXILOp<114, waveAllTrue> {
@@ -989,6 +1011,7 @@ def WaveActiveAllTrue : DXILOp<114, waveAllTrue> {
989
1011
let arguments = [Int1Ty];
990
1012
let result = Int1Ty;
991
1013
let stages = [Stages<DXIL1_0, [all_stages]>];
1014
+ let properties = [IsWave];
992
1015
}
993
1016
994
1017
def WaveActiveAnyTrue : DXILOp<113, waveAnyTrue> {
@@ -997,6 +1020,7 @@ def WaveActiveAnyTrue : DXILOp<113, waveAnyTrue> {
997
1020
let arguments = [Int1Ty];
998
1021
let result = Int1Ty;
999
1022
let stages = [Stages<DXIL1_0, [all_stages]>];
1023
+ let properties = [IsWave];
1000
1024
}
1001
1025
1002
1026
def WaveActiveOp : DXILOp<119, waveActiveOp> {
@@ -1023,7 +1047,7 @@ def WaveIsFirstLane : DXILOp<110, waveIsFirstLane> {
1023
1047
let arguments = [];
1024
1048
let result = Int1Ty;
1025
1049
let stages = [Stages<DXIL1_0, [all_stages]>];
1026
- let attributes = [Attributes<DXIL1_0, [ReadNone]> ];
1050
+ let properties = [IsWave ];
1027
1051
}
1028
1052
1029
1053
def WaveReadLaneAt: DXILOp<117, waveReadLaneAt> {
@@ -1033,7 +1057,7 @@ def WaveReadLaneAt: DXILOp<117, waveReadLaneAt> {
1033
1057
let result = OverloadTy;
1034
1058
let overloads = [Overloads<DXIL1_0, [HalfTy, FloatTy, DoubleTy, Int1Ty, Int16Ty, Int32Ty, Int64Ty]>];
1035
1059
let stages = [Stages<DXIL1_0, [all_stages]>];
1036
- let attributes = [Attributes<DXIL1_0, [ReadNone]> ];
1060
+ let properties = [IsWave ];
1037
1061
}
1038
1062
1039
1063
def WaveGetLaneIndex : DXILOp<111, waveGetLaneIndex> {
@@ -1042,7 +1066,8 @@ def WaveGetLaneIndex : DXILOp<111, waveGetLaneIndex> {
1042
1066
let arguments = [];
1043
1067
let result = Int32Ty;
1044
1068
let stages = [Stages<DXIL1_0, [all_stages]>];
1045
- let attributes = [Attributes<DXIL1_0, [ReadNone]>];
1069
+ let attributes = [Attributes<DXIL1_0, [ReadOnly]>];
1070
+ let properties = [IsWave];
1046
1071
}
1047
1072
1048
1073
def WaveAllBitCount : DXILOp<135, waveAllOp> {
@@ -1051,7 +1076,7 @@ def WaveAllBitCount : DXILOp<135, waveAllOp> {
1051
1076
let arguments = [Int1Ty];
1052
1077
let result = Int32Ty;
1053
1078
let stages = [Stages<DXIL1_0, [all_stages]>];
1054
- let attributes = [Attributes<DXIL1_0, [ReadNone]> ];
1079
+ let properties = [IsWave ];
1055
1080
}
1056
1081
1057
1082
def Barrier : DXILOp<80, barrier> {
@@ -1066,4 +1091,5 @@ def Barrier : DXILOp<80, barrier> {
1066
1091
let result = VoidTy;
1067
1092
let stages = [Stages<DXIL1_0, [compute, library]>];
1068
1093
let attributes = [Attributes<DXIL1_0, []>];
1094
+ let properties = [IsBarrier];
1069
1095
}
0 commit comments