@@ -733,7 +733,7 @@ absl::StatusOr<FusionEmissionResult> EmitGemm(
733733 }
734734
735735 FusionEmissionResult result;
736- result.thunks . push_back (std::move (thunk));
736+ result.thunks = ThunkSequence::Of (std::move (thunk));
737737 return result;
738738}
739739
@@ -1051,7 +1051,7 @@ absl::StatusOr<FusionEmissionResult> EmitCustomCall(
10511051 }
10521052
10531053 FusionEmissionResult result;
1054- result.thunks . push_back (std::move (thunk));
1054+ result.thunks = ThunkSequence::Of (std::move (thunk));
10551055 return result;
10561056}
10571057
@@ -1257,8 +1257,6 @@ absl::StatusOr<FusionEmissionResult> EmitCollective(
12571257 Thunk::ThunkInfo thunk_info = Thunk::ThunkInfo::WithProfileAnnotation (
12581258 instr, ir_emitter_context.GetNextThunkId ());
12591259
1260- FusionEmissionResult result;
1261-
12621260 // First we get the thunk sequence. This decides whether to generate a d2d
12631261 // copy thunk or collective thunk.
12641262 ThunkSequence seq;
@@ -1312,6 +1310,7 @@ absl::StatusOr<FusionEmissionResult> EmitCollective(
13121310 return implementable_status;
13131311 }
13141312
1313+ FusionEmissionResult result;
13151314 // Depending on whether this is a dynamic fusion or not, we wrap the
13161315 // thunk(s) within a dynamic-slice thunk.
13171316 if (slice_data.isDynamic ) {
@@ -1333,11 +1332,9 @@ absl::StatusOr<FusionEmissionResult> EmitCollective(
13331332 std::move (slice_data.orig_shapes ), std::move (slice_data.sliced_shapes ),
13341333 std::move (slice_data.offset_primitive_types ),
13351334 std::move (offset_modules_metadata));
1336- result.thunks . push_back (std::move (thunk));
1335+ result.thunks = ThunkSequence::Of (std::move (thunk));
13371336 } else {
1338- for (auto & thunk : seq) {
1339- result.thunks .push_back (std::move (thunk));
1340- }
1337+ result.thunks = std::move (seq);
13411338 }
13421339 return result;
13431340}
@@ -1380,14 +1377,11 @@ absl::StatusOr<FusionEmissionResult> CustomFusion::Emit(
13801377 " returned empty custom kernels for a fused computation" ));
13811378 }
13821379
1383- TF_ASSIGN_OR_RETURN (auto thunk,
1384- BuildCustomKernelThunkForFusion (
1385- ir_emitter_context, fusion,
1386- std::move (kernels[config.kernel_index ()])));
1380+ ASSIGN_OR_RETURN (auto thunk, BuildCustomKernelThunkForFusion (
1381+ ir_emitter_context, fusion,
1382+ std::move (kernels[config.kernel_index ()])));
13871383
1388- FusionEmissionResult result;
1389- result.thunks .push_back (std::move (thunk));
1390- return result;
1384+ return FusionEmissionResult{ThunkSequence::Of (std::move (thunk))};
13911385}
13921386
13931387absl::StatusOr<FusionEmissionResult> DynamicSliceFusion::Emit (
0 commit comments