@@ -485,6 +485,16 @@ class WaitcntGenerator {
485
485
virtual AMDGPU::Waitcnt getAllZeroWaitcnt (bool IncludeVSCnt) const = 0;
486
486
487
487
virtual ~WaitcntGenerator () = default ;
488
+
489
+ // Create a mask value from the initializer list of wait event types.
490
+ static constexpr unsigned
491
+ eventMask (std::initializer_list<WaitEventType> Events) {
492
+ unsigned Mask = 0 ;
493
+ for (auto &E : Events)
494
+ Mask |= 1 << E;
495
+
496
+ return Mask;
497
+ }
488
498
};
489
499
490
500
class WaitcntGeneratorPreGFX12 : public WaitcntGenerator {
@@ -506,14 +516,12 @@ class WaitcntGeneratorPreGFX12 : public WaitcntGenerator {
506
516
assert (ST);
507
517
508
518
static const unsigned WaitEventMaskForInstPreGFX12[NUM_INST_CNTS] = {
509
- (1 << VMEM_ACCESS) | (1 << VMEM_READ_ACCESS) |
510
- (1 << VMEM_SAMPLER_READ_ACCESS) | (1 << VMEM_BVH_READ_ACCESS),
511
- (1 << SMEM_ACCESS) | (1 << LDS_ACCESS) | (1 << GDS_ACCESS) |
512
- (1 << SQ_MESSAGE),
513
- (1 << EXP_GPR_LOCK) | (1 << GDS_GPR_LOCK) | (1 << VMW_GPR_LOCK) |
514
- (1 << EXP_PARAM_ACCESS) | (1 << EXP_POS_ACCESS) |
515
- (1 << EXP_LDS_ACCESS),
516
- (1 << VMEM_WRITE_ACCESS) | (1 << SCRATCH_WRITE_ACCESS),
519
+ eventMask ({VMEM_ACCESS, VMEM_READ_ACCESS, VMEM_SAMPLER_READ_ACCESS,
520
+ VMEM_BVH_READ_ACCESS}),
521
+ eventMask ({SMEM_ACCESS, LDS_ACCESS, GDS_ACCESS, SQ_MESSAGE}),
522
+ eventMask ({EXP_GPR_LOCK, GDS_GPR_LOCK, VMW_GPR_LOCK, EXP_PARAM_ACCESS,
523
+ EXP_POS_ACCESS, EXP_LDS_ACCESS}),
524
+ eventMask ({VMEM_WRITE_ACCESS, SCRATCH_WRITE_ACCESS}),
517
525
0 ,
518
526
0 ,
519
527
0 };
@@ -543,15 +551,14 @@ class WaitcntGeneratorGFX12Plus : public WaitcntGenerator {
543
551
assert (ST);
544
552
545
553
static const unsigned WaitEventMaskForInstGFX12Plus[NUM_INST_CNTS] = {
546
- (1 << VMEM_ACCESS) | (1 << VMEM_READ_ACCESS),
547
- (1 << LDS_ACCESS) | (1 << GDS_ACCESS),
548
- (1 << EXP_GPR_LOCK) | (1 << GDS_GPR_LOCK) | (1 << VMW_GPR_LOCK) |
549
- (1 << EXP_PARAM_ACCESS) | (1 << EXP_POS_ACCESS) |
550
- (1 << EXP_LDS_ACCESS),
551
- (1 << VMEM_WRITE_ACCESS) | (1 << SCRATCH_WRITE_ACCESS),
552
- (1 << VMEM_SAMPLER_READ_ACCESS),
553
- (1 << VMEM_BVH_READ_ACCESS),
554
- (1 << SMEM_ACCESS) | (1 << SQ_MESSAGE)};
554
+ eventMask ({VMEM_ACCESS, VMEM_READ_ACCESS}),
555
+ eventMask ({LDS_ACCESS, GDS_ACCESS}),
556
+ eventMask ({EXP_GPR_LOCK, GDS_GPR_LOCK, VMW_GPR_LOCK, EXP_PARAM_ACCESS,
557
+ EXP_POS_ACCESS, EXP_LDS_ACCESS}),
558
+ eventMask ({VMEM_WRITE_ACCESS, SCRATCH_WRITE_ACCESS}),
559
+ eventMask ({VMEM_SAMPLER_READ_ACCESS}),
560
+ eventMask ({VMEM_BVH_READ_ACCESS}),
561
+ eventMask ({SMEM_ACCESS, SQ_MESSAGE})};
555
562
556
563
return WaitEventMaskForInstGFX12Plus;
557
564
}
0 commit comments