@@ -30,6 +30,7 @@ limitations under the License.
3030#include " absl/strings/str_cat.h"
3131#include " absl/strings/string_view.h"
3232#include " absl/types/span.h"
33+ #include " xla/tsl/platform/status_macros.h"
3334#include " llvm/ADT/STLExtras.h"
3435#include " mlir/AsmParser/AsmParser.h"
3536#include " mlir/IR/Attributes.h"
@@ -732,9 +733,7 @@ absl::StatusOr<FusionEmissionResult> EmitGemm(
732733 deterministic_ops);
733734 }
734735
735- FusionEmissionResult result;
736- result.thunks .push_back (std::move (thunk));
737- return result;
736+ return FusionEmissionResult{ThunkSequence::Of (std::move (thunk))};
738737}
739738
740739absl::StatusOr<FusionEmissionResult> EmitCustomCall (
@@ -1050,9 +1049,7 @@ absl::StatusOr<FusionEmissionResult> EmitCustomCall(
10501049 : legacy_thunk (std::move (operands), std::move (results)));
10511050 }
10521051
1053- FusionEmissionResult result;
1054- result.thunks .push_back (std::move (thunk));
1055- return result;
1052+ return FusionEmissionResult{ThunkSequence::Of (std::move (thunk))};
10561053}
10571054
10581055using Slice = std::optional<BufferAllocation::Slice>;
@@ -1257,8 +1254,6 @@ absl::StatusOr<FusionEmissionResult> EmitCollective(
12571254 Thunk::ThunkInfo thunk_info = Thunk::ThunkInfo::WithProfileAnnotation (
12581255 instr, ir_emitter_context.GetNextThunkId ());
12591256
1260- FusionEmissionResult result;
1261-
12621257 // First we get the thunk sequence. This decides whether to generate a d2d
12631258 // copy thunk or collective thunk.
12641259 ThunkSequence seq;
@@ -1312,6 +1307,7 @@ absl::StatusOr<FusionEmissionResult> EmitCollective(
13121307 return implementable_status;
13131308 }
13141309
1310+ FusionEmissionResult result;
13151311 // Depending on whether this is a dynamic fusion or not, we wrap the
13161312 // thunk(s) within a dynamic-slice thunk.
13171313 if (slice_data.isDynamic ) {
@@ -1333,11 +1329,9 @@ absl::StatusOr<FusionEmissionResult> EmitCollective(
13331329 std::move (slice_data.orig_shapes ), std::move (slice_data.sliced_shapes ),
13341330 std::move (slice_data.offset_primitive_types ),
13351331 std::move (offset_modules_metadata));
1336- result.thunks . push_back (std::move (thunk));
1332+ result.thunks = ThunkSequence::Of (std::move (thunk));
13371333 } else {
1338- for (auto & thunk : seq) {
1339- result.thunks .push_back (std::move (thunk));
1340- }
1334+ result.thunks = std::move (seq);
13411335 }
13421336 return result;
13431337}
@@ -1380,14 +1374,11 @@ absl::StatusOr<FusionEmissionResult> CustomFusion::Emit(
13801374 " returned empty custom kernels for a fused computation" ));
13811375 }
13821376
1383- TF_ASSIGN_OR_RETURN (auto thunk,
1384- BuildCustomKernelThunkForFusion (
1385- ir_emitter_context, fusion,
1386- std::move (kernels[config.kernel_index ()])));
1377+ ASSIGN_OR_RETURN (auto thunk, BuildCustomKernelThunkForFusion (
1378+ ir_emitter_context, fusion,
1379+ std::move (kernels[config.kernel_index ()])));
13871380
1388- FusionEmissionResult result;
1389- result.thunks .push_back (std::move (thunk));
1390- return result;
1381+ return FusionEmissionResult{ThunkSequence::Of (std::move (thunk))};
13911382}
13921383
13931384absl::StatusOr<FusionEmissionResult> DynamicSliceFusion::Emit (
0 commit comments