Skip to content

Commit 0177a95

Browse files
authored
[flang][cuda] Fix fir.cuda_kernel_launch assembly with no args (#85987)
When the kernel launch has no arguments, the generated parser was expecting at least a type to be present. Make the last part of the assemble format optional. Add a run line to round-trip the output through fir-opt so we make sure the IR can be parsed and printed correctly.
1 parent d9c4c31 commit 0177a95

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

flang/include/flang/Optimizer/Dialect/FIROps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2466,7 +2466,7 @@ def fir_CUDAKernelLaunch : fir_Op<"cuda_kernel_launch", [CallOpInterface,
24662466
let assemblyFormat = [{
24672467
$callee `<` `<` `<` $grid_x `,` $grid_y `,` $grid_z `,`$block_x `,`
24682468
$block_y `,` $block_z ( `,` $bytes^ ( `,` $stream^ )? )? `>` `>` `>`
2469-
`` `(` $args `)` `:` `(` type($args) `)` attr-dict
2469+
`` `(` $args `)` ( `:` `(` type($args)^ `)` )? attr-dict
24702470
}];
24712471

24722472
let extraClassDeclaration = [{

flang/test/Lower/CUDA/cuda-kernel-calls.cuf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
2+
! RUN: bbc -emit-hlfir -fcuda %s -o - | fir-opt | FileCheck %s
23

34
! Test lowering of CUDA procedure calls.
45

0 commit comments

Comments
 (0)