@@ -35,6 +35,11 @@ def AMDGPU_Dialect : Dialect {
35
35
let useDefaultAttributePrinterParser = 1;
36
36
}
37
37
38
+ def AnyIntegerOrFloat : AnyTypeOf<[AnySignlessInteger, AnyFloat], "Integer or Float">;
39
+
40
+ def AnyIntegerOrFloatOr1DVector :
41
+ AnyTypeOf<[AnyIntegerOrFloat, VectorOfRankAndType<[1], [AnyIntegerOrFloat]>]>;
42
+
38
43
//===----------------------------------------------------------------------===//
39
44
// AMDGPU general attribute definitions
40
45
//===----------------------------------------------------------------------===//
@@ -533,14 +538,15 @@ def AMDGPU_DPPPerm : I32EnumAttr<"DPPPerm",
533
538
def AMDGPU_DPPPermAttr : EnumAttr<AMDGPU_Dialect, AMDGPU_DPPPerm,
534
539
"dpp_perm">;
535
540
536
- def AMDGPU_DPPOp : AMDGPU_Op<"dpp", [SameTypeOperands, AllTypesMatch<["result", "old", "src"]>]>,
541
+ def AMDGPU_DPPOp : AMDGPU_Op<"dpp",
542
+ [Pure, SameTypeOperands, AllTypesMatch<["result", "old", "src"]>]>,
537
543
Arguments<(ins AnyType:$old,
538
- AnyType:$src,
539
- AMDGPU_DPPPermAttr:$kind,
540
- OptionalAttr<AnyAttrOf<[I32Attr, ArrayAttr, UnitAttr]>>:$permArgument,
541
- DefaultValuedAttr<I32Attr, "0xf">:$row_mask,
542
- DefaultValuedAttr<I32Attr, "0xf">:$bank_mask,
543
- DefaultValuedAttr<BoolAttr, "false">:$bound_ctrl)> {
544
+ AnyType:$src,
545
+ AMDGPU_DPPPermAttr:$kind,
546
+ OptionalAttr<AnyAttrOf<[I32Attr, ArrayAttr, UnitAttr]>>:$permArgument,
547
+ DefaultValuedAttr<I32Attr, "0xf">:$row_mask,
548
+ DefaultValuedAttr<I32Attr, "0xf">:$bank_mask,
549
+ DefaultValuedAttr<BoolAttr, "false">:$bound_ctrl)> {
544
550
let summary = "AMDGPU DPP operation";
545
551
let description = [{
546
552
This operation represents DPP functionality in a GPU program.
@@ -565,6 +571,27 @@ def AMDGPU_DPPOp : AMDGPU_Op<"dpp", [SameTypeOperands, AllTypesMatch<["result",
565
571
let hasVerifier = 1;
566
572
}
567
573
574
+ def AMDGPU_SwizzleBitModeOp : AMDGPU_Op<"swizzle_bitmode",
575
+ [Pure, AllTypesMatch<["result", "src"]>]>,
576
+ Arguments<(ins AnyIntegerOrFloatOr1DVector:$src,
577
+ I32Attr:$and_mask,
578
+ I32Attr:$or_mask,
579
+ I32Attr:$xor_mask
580
+ )> {
581
+ let summary = "AMDGPU ds_swizzle op, bitmode variant";
582
+ let description = [{
583
+ High-level wrapper on bitmode `rocdl.ds_swizzle` op, masks are represented
584
+ as separate fields so user won't need to do manual bitpacking.
585
+
586
+ Supports arbitrary int/float/vector types, which will be repacked to i32 and
587
+ one or more `rocdl.ds_swizzle` ops during lowering.
588
+ }];
589
+ let results = (outs AnyIntegerOrFloatOr1DVector:$result);
590
+ let assemblyFormat = [{
591
+ $src $and_mask $or_mask $xor_mask attr-dict `:` type($result)
592
+ }];
593
+ }
594
+
568
595
def AMDGPU_LDSBarrierOp : AMDGPU_Op<"lds_barrier"> {
569
596
let summary = "Barrier that includes a wait for LDS memory operations.";
570
597
let description = [{
@@ -794,7 +821,7 @@ def AMDGPU_GatherToLDSOp :
794
821
795
822
The `$dst`, along with its indices, points to the memory location the subgroup of this thread
796
823
will write to.
797
-
824
+
798
825
Note: only enabled for gfx942 and later.
799
826
}];
800
827
let assemblyFormat = [{
0 commit comments