Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jjsjann123 committed Dec 24, 2024
1 parent 17d9e39 commit dd0573b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions csrc/preseg_passes/consecutive_cast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,21 +199,22 @@ void castOptimizationPass(Fusion* fusion) {
if (isMovableMeta(expr->input(0)->definition())) {
Expr* meta = expr->input(0)->definition();

// replayed cast
// replayed cast.
Val* replayed_expr_out =
castOp(expr->output(0)->dtype(), meta->input(0));

// replayed meta
// replay meta on new inputs
Expr* replayed_meta = nvfuser::ir_utils::replaceValInExprInputs(
meta, meta->input(0), replayed_expr_out);
// update replayed meta output
// preparing new meta output.
Val* replayed_meta_out = ops::newValLike(
meta->output(0), meta->output(0)->getDataType().value());

// replay meta on new inputs.
Expr* replayed_meta = nvfuser::ir_utils::replaceValInExprInputs(
meta, meta->input(0), replayed_expr_out);
// update replayed meta output.
replayed_meta = ir_utils::transferDefinitionToNewOutputs(
replayed_meta, {replayed_meta_out});

// replace uses of old second output
// replace uses of old second output.
ir_utils::replaceValInAllExprInputsAndFusionOutputs(
expr->output(0), replayed_meta_out);

Expand Down

0 comments on commit dd0573b

Please sign in to comment.