Skip to content

Commit 164e5ef

Browse files
committed
fx
1 parent c1292a3 commit 164e5ef

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def NVVM_PMEventOp : NVVM_PTXBuilder_Op<"pmevent">,
418418
immediate operand a, in the range 0..15.
419419

420420
With `mask` it triggers one or more of the performance monitor events. Each
421-
bit in the 16-bit immediate operand a controls an event.
421+
bit in the 16-bit immediate operand controls an event.
422422

423423
[For more information, see PTX ISA](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#miscellaneous-instructions-pmevent)
424424
}];
@@ -431,7 +431,7 @@ def NVVM_PMEventOp : NVVM_PTXBuilder_Op<"pmevent">,
431431
let assemblyFormat = "attr-dict (`id` `=` $eventId^)? (`mask` `=` $maskedEventId^)?";
432432

433433
let extraClassDeclaration = [{
434-
bool hasIntrinsic() { if(getEventId()) return false; return true; }
434+
bool hasIntrinsic() { return !getEventId(); }
435435
}];
436436
let extraClassDefinition = [{
437437
std::string $cppClass::getPtx() { return std::string("pmevent %0;"); }

mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,18 @@ LogicalResult BulkStoreOp::verify() {
190190
}
191191

192192
LogicalResult PMEventOp::verify() {
193-
if (!getMaskedEventId() && !getEventId()) {
193+
auto eventId = getEventId();
194+
auto maskedEventId = getMaskedEventId();
195+
if (!maskedEventId && !eventId) {
194196
return emitOpError() << "either `id` or `mask` must be set";
195197
}
196198

197-
if (getMaskedEventId() && getEventId()) {
199+
if (maskedEventId && eventId) {
198200
return emitOpError() << "`id` and `mask` cannot be set at the same time";
199201
}
200202

201-
if (getEventId()) {
202-
if (getEventId() < 0 || getEventId() > 15) {
203+
if (eventId) {
204+
if (eventId < 0 || eventId > 15) {
203205
return emitOpError() << "`id` must be between 0 and 15";
204206
}
205207
}

0 commit comments

Comments
 (0)