@@ -59,7 +59,7 @@ def Neura_KernelOp : Op<NeuraDialect, "kernel", [RecursiveMemoryEffects, SingleB
5959}
6060
6161// Yield operation for fused_op and kernel regions.
62- def Neura_YieldOp : Op<NeuraDialect, "yield", [Terminator, Pure, ReturnLike, HasParent<"FusedOp, KernelOp"> ]> {
62+ def Neura_YieldOp : Op<NeuraDialect, "yield", [Terminator, Pure, ReturnLike]> {
6363 let summary = "Yield values from a neura.kernel or neura.fused_op region.";
6464 let description = [{
6565 Returns values from a neura.kernel or neura.fused_op region to the parent operation.
@@ -79,6 +79,8 @@ def Neura_YieldOp : Op<NeuraDialect, "yield", [Terminator, Pure, ReturnLike, Has
7979 ];
8080
8181 let assemblyFormat = [{($values^ `:` type($values))? attr-dict}];
82+
83+ let hasVerifier = 1;
8284}
8385
8486
@@ -375,6 +377,46 @@ def Neura_ReturnOp : Op<NeuraDialect, "return", [Terminator]> {
375377 // let assemblyFormat = "($values^)? `,` attr-dict";
376378}
377379
380+ // Defines a return operation for void functions in dataflow mode.
381+ def Neura_ReturnVoidOp : Op<NeuraDialect, "return_void", []>{
382+ let summary = "Return operation for void functions in dataflow mode.";
383+ let description = [{
384+ Terminates a void function. The trigger operand provides the execution
385+ condition in dataflow mode - the return executes when the trigger becomes valid.
386+
387+ Without a trigger (empty operands), this represents a static return that
388+ always executes. After canonicalization, void returns should have triggers.
389+
390+ Example:
391+ neura.return_void %cond : !neura.data<i1, i1> // In dataflow mode
392+ ...
393+ neura.yield // Function ends here.
394+
395+ This is NOT a terminator - the block ends with neura.yield instead.
396+ }];
397+ let arguments = (ins Optional<AnyType>:$trigger);
398+ let assemblyFormat = "($trigger^ `:` type($trigger))? attr-dict";
399+ }
400+
401+ // Defines a return operation for non-void fnctions in dataflow mode.
402+ def Neura_ReturnValueOp : Op<NeuraDialect, "return_value", []>{
403+ let summary = "Return operation for non-void functions in dataflow mode.";
404+ let description = [{
405+ Represents a return point for non-void functions in dataflow mode.
406+ The value operand provides the return value and the trigger operand.
407+
408+ This is NOT a terminator - the block ends with neura.yield instead.
409+
410+ Example:
411+ neura.return_value %ret_val : !neura.data<i32, i1> // In dataflow mode
412+ ...
413+ neura.yield // Function ends here.
414+ }];
415+ let arguments = (ins Variadic<AnyType>:$values);
416+ let assemblyFormat = "($values^ `:` type($values))? attr-dict";
417+ }
418+
419+
378420// Defines a cast operation for type conversion.
379421def Neura_CastOp : Op<NeuraDialect, "cast">{
380422 let summary = "Generic type conversion operation";
0 commit comments