-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[MLIR][NVVM] Fix assertion failure for insufficient parsing validation of nvvm dialect PureSpecialRangeableRegisterOp #163434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
ba87fab
6d128fd
c26f5db
c791da3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -263,6 +263,7 @@ class NVVM_PureSpecialRangeableRegisterOp<string mnemonic, list<Trait> traits = | |
| let assemblyFormat = "(`range` $range^)? attr-dict `:` type($res)"; | ||
| let llvmBuilder = baseLlvmBuilder # setRangeRetAttrCode # baseLlvmBuilderCoda; | ||
| let mlirBuilder = baseMlirBuilder # importRangeRetAttrCode # baseMlirBuilderCoda; | ||
| let hasVerifier = 1; | ||
|
|
||
| // Backwards-compatibility builder for an unspecified range. | ||
| let builders = [ | ||
|
|
@@ -279,6 +280,23 @@ class NVVM_PureSpecialRangeableRegisterOp<string mnemonic, list<Trait> traits = | |
| SetIntRangeFn setResultRanges) { | ||
| nvvmInferResultRanges(getOperation(), getResult(), argRanges, setResultRanges); | ||
| } | ||
|
|
||
| // Verify the range attribute satisfies LLVM ConstantRange constructor requirements. | ||
| ::llvm::LogicalResult $cppClass::verify() { | ||
| auto rangeAttr = getRange(); | ||
| if (!rangeAttr) | ||
| return ::mlir::success(); // No range specified, validation passes | ||
|
|
||
| const ::llvm::APInt &lower = rangeAttr->getLower(); | ||
|
||
| const ::llvm::APInt &upper = rangeAttr->getUpper(); | ||
|
|
||
| // Check LLVM ConstantRange constructor condition | ||
| if (!(lower != upper || (lower.isMaxValue() || lower.isMinValue()))) { | ||
smada3 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return emitOpError("invalid range attribute: range must be a valid constant range"); | ||
|
||
| } | ||
|
|
||
| return ::mlir::success(); | ||
| } | ||
| }]; | ||
|
|
||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.