Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit d67e305

Browse files
author
Sven Verdoolaege
committed
tc2halide: refrain from marking reduction init nodes
The markings are not needed. In fact reduction handling in TC is completely independent of even the presence of reduction initializations.
1 parent 1f0454a commit d67e305

File tree

5 files changed

+5
-16
lines changed

5 files changed

+5
-16
lines changed

tc/core/halide_utils.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ std::string halideCodegenC(const Stmt& stmt) {
123123
using IRPrinter::visit;
124124

125125
void visit(const Call* op) override {
126-
if (op->is_intrinsic(tc2halide::kReductionInit) ||
127-
op->is_intrinsic(tc2halide::kReductionUpdate)) {
126+
if (op->is_intrinsic(tc2halide::kReductionUpdate)) {
128127
op->args[0].accept(this);
129128
} else if (
130129
op->call_type == Call::Halide || op->call_type == Call::Image) {

tc/core/polyhedral/codegen_llvm.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,7 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 {
234234
auto addr = builder->CreateInBoundsGEP(baseAddr, args);
235235
value = builder->CreateLoad(addr);
236236
return;
237-
} else if (
238-
call->is_intrinsic(tc2halide::kReductionInit) ||
239-
call->is_intrinsic(tc2halide::kReductionUpdate)) {
237+
} else if (call->is_intrinsic(tc2halide::kReductionUpdate)) {
240238
call->args[0].accept(this);
241239
return;
242240
} else {

tc/core/polyhedral/cuda/codegen.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,7 @@ void emitHalideExpr(
550550
op->call_type == Halide::Internal::Call::CallType::Image) {
551551
tc::polyhedral::detail::emitMappedTensorAccess(
552552
op->name, op, op->args, context);
553-
} else if (
554-
op->is_intrinsic(tc2halide::kReductionInit) ||
555-
op->is_intrinsic(tc2halide::kReductionUpdate)) {
553+
} else if (op->is_intrinsic(tc2halide::kReductionUpdate)) {
556554
op->args[0].accept(this);
557555
} else {
558556
IRPrinter::visit(op);

tc/core/tc2halide.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,6 @@ void forwardBoundsInference(
484484
}
485485
}
486486

487-
Expr reductionInit(Expr e) {
488-
return Call::make(e.type(), kReductionInit, {e}, Call::Intrinsic);
489-
}
490-
491487
Expr reductionUpdate(Expr e) {
492488
return Call::make(e.type(), kReductionUpdate, {e}, Call::Intrinsic);
493489
}
@@ -819,8 +815,7 @@ HalideComponents translateDef(const lang::Def& def, bool throwWarnings) {
819815
op->name, {reductionUpdate(op->values[0])}, op->args);
820816
} else {
821817
found_init = true;
822-
return Provide::make(
823-
op->name, {reductionInit(op->values[0])}, op->args);
818+
return op;
824819
}
825820
} else {
826821
return op;

tc/core/tc2halide.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ struct HalideComponents {
4040
};
4141

4242
// For TC reductions, the right-hand-sides of the corresponding
43-
// Provide nodes are tagged with intrinsics with the following names.
44-
Halide::Internal::Call::ConstString kReductionInit = "ReductionInit";
43+
// Provide nodes are tagged with intrinsics with the following name.
4544
Halide::Internal::Call::ConstString kReductionUpdate = "ReductionUpdate";
4645

4746
// Translate a TC parse tree into equivalent Halide imperative IR with

0 commit comments

Comments
 (0)