mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-03 16:46:07 +00:00
[flang][cuda] fix parsing of cuda_kernel (#89613)
Fix parsing of cuda_kernel: it missed a mlir::succeeded check and it was not setting up the `types` and causing mismatch between values and types of the grid/block (CUFKernelValues). @clementval --------- Co-authored-by: Iman Hosseini <imanh@nvidia.com> Co-authored-by: Valentin Clement (バレンタイン クレメン) <clementval@gmail.com>
This commit is contained in:
parent
8128d4b122
commit
7c20576cc3
@ -3907,7 +3907,7 @@ mlir::ParseResult parseCUFKernelValues(
|
||||
if (mlir::succeeded(parser.parseOptionalStar()))
|
||||
return mlir::success();
|
||||
|
||||
if (parser.parseOptionalLParen()) {
|
||||
if (mlir::succeeded(parser.parseOptionalLParen())) {
|
||||
if (mlir::failed(parser.parseCommaSeparatedList(
|
||||
mlir::AsmParser::Delimiter::None, [&]() {
|
||||
if (parser.parseOperand(values.emplace_back()))
|
||||
@ -3915,11 +3915,17 @@ mlir::ParseResult parseCUFKernelValues(
|
||||
return mlir::success();
|
||||
})))
|
||||
return mlir::failure();
|
||||
auto builder = parser.getBuilder();
|
||||
for (size_t i = 0; i < values.size(); i++) {
|
||||
types.emplace_back(builder.getI32Type());
|
||||
}
|
||||
if (parser.parseRParen())
|
||||
return mlir::failure();
|
||||
} else {
|
||||
if (parser.parseOperand(values.emplace_back()))
|
||||
return mlir::failure();
|
||||
auto builder = parser.getBuilder();
|
||||
types.emplace_back(builder.getI32Type());
|
||||
return mlir::success();
|
||||
}
|
||||
return mlir::success();
|
||||
|
@ -1,4 +1,5 @@
|
||||
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
|
||||
! RUN: bbc -emit-hlfir -fcuda %s -o - | fir-opt | FileCheck %s
|
||||
|
||||
! Test lowering of CUDA kernel loop directive.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user