Skip to content

Commit 5fa5519

Browse files
committed
tiling: Remove OutputStage::Done()
Remove OutputStage::Done() and explicitly test the output interval size from the top level pipeline. We also set the branch complete flag with a new helper OutputStage::SetBranchComplete() to be explicit. Rename OutputStage::BranchComplete() to OutputStage::GetBranchComplete() for consistency. Similarly rename BranchInactive() to GetBranchInactive(). Signed-off-by: Naushir Patuck <[email protected]>
1 parent 17cf7b0 commit 5fa5519

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

src/libpisp/backend/tiling/crop_stage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void CropStage::PushCropDown(Interval interval, Dir dir)
121121
downstream_->PushCropDown(output_interval_, dir);
122122
}
123123

124-
bool CropStage::BranchInactive() const
124+
bool CropStage::GetBranchInactive() const
125125
{
126126
return !output_interval_.length;
127127
}

src/libpisp/backend/tiling/crop_stage.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CropStage : public BasicStage
2525
virtual int PushEndDown(int input_end, Dir dir) override;
2626
virtual void PushEndUp(int output_end, Dir dir) override;
2727
virtual void PushCropDown(Interval interval, Dir dir) override;
28-
bool BranchInactive() const override;
28+
bool GetBranchInactive() const override;
2929

3030
private:
3131
Config config_;

src/libpisp/backend/tiling/pipeline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int Pipeline::tileDirection(Dir dir, void *mem, size_t num_items, size_t item_si
8282
throw std::runtime_error("Too many tiles!");
8383
for (auto s : outputs_)
8484
{
85-
if (!s->BranchComplete())
85+
if (!s->GetBranchComplete())
8686
s->PushStartUp(s->GetOutputInterval().End(), dir);
8787
}
8888
for (auto s : inputs_)

src/libpisp/backend/tiling/split_stage.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void SplitStage::PushStartUp(int output_start, Dir dir)
5252

5353
unsigned int branch_incomplete_count = 0;
5454
for (auto const &d : downstream_)
55-
if (!d->BranchComplete())
55+
if (!d->GetBranchComplete())
5656
branch_incomplete_count++;
5757

5858
if (count_ == branch_incomplete_count)
@@ -73,7 +73,7 @@ int SplitStage::PushEndDown(int input_end, Dir dir)
7373
input_interval_.SetEnd(0);
7474
for (auto d : downstream_)
7575
{
76-
if (d->BranchComplete())
76+
if (d->GetBranchComplete())
7777
continue;
7878
int branch_end = d->PushEndDown(input_end, dir);
7979
// (It is OK for a branch to make no progress at all - so long as another branch does!)
@@ -90,7 +90,7 @@ int SplitStage::PushEndDown(int input_end, Dir dir)
9090
}
9191

9292
for (auto d : downstream_)
93-
if (!d->BranchComplete())
93+
if (!d->GetBranchComplete())
9494
d->PushEndDown(input_interval_.End(), dir);
9595

9696
PushEndUp(input_interval_.End(), dir);
@@ -114,7 +114,7 @@ void SplitStage::PushCropDown(Interval interval, Dir dir)
114114
input_interval_ = interval;
115115
for (auto d : downstream_)
116116
{
117-
if (d->BranchComplete())
117+
if (d->GetBranchComplete())
118118
continue;
119119
PISP_LOG(debug, "(" << name_ << ") Exit with interval " << interval);
120120
d->PushCropDown(interval, dir);
@@ -125,17 +125,17 @@ void SplitStage::CopyOut([[maybe_unused]] void *dest, [[maybe_unused]] Dir dir)
125125
{
126126
}
127127

128-
bool SplitStage::BranchComplete() const
128+
bool SplitStage::GetBranchComplete() const
129129
{
130130
bool done = true;
131131
for (auto d : downstream_)
132-
done &= d->BranchComplete();
132+
done &= d->GetBranchComplete();
133133
return done;
134134
}
135135

136-
bool SplitStage::BranchInactive() const
136+
bool SplitStage::GetBranchInactive() const
137137
{
138138
if (!upstream_)
139139
return false;
140-
return upstream_->BranchInactive();
140+
return upstream_->GetBranchInactive();
141141
}

src/libpisp/backend/tiling/split_stage.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class SplitStage : public Stage
2626
virtual void PushEndUp(int output_end, Dir dir);
2727
virtual void PushCropDown(Interval interval, Dir dir);
2828
virtual void CopyOut(void *dest, Dir dir);
29-
virtual bool BranchComplete() const;
30-
virtual bool BranchInactive() const;
29+
virtual bool GetBranchComplete() const;
30+
virtual bool GetBranchInactive() const;
3131

3232
private:
3333
Stage *upstream_;

src/libpisp/backend/tiling/stages.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ void BasicStage::CopyOut(void *dest, Dir dir)
7676
{
7777
Region *region = (Region *)((uint8_t *)dest + struct_offset_);
7878

79-
PISP_LOG(debug, "(" << name_ << ") complete: " << BranchComplete() << " inactive: " << BranchInactive());
80-
if (BranchComplete() || BranchInactive())
79+
PISP_LOG(debug, "(" << name_ << ") complete: " << GetBranchComplete() << " inactive: " << GetBranchInactive());
80+
if (GetBranchComplete() || GetBranchInactive())
8181
BasicStage::Reset();
8282

8383
region->input[dir] = input_interval_;
@@ -86,14 +86,14 @@ void BasicStage::CopyOut(void *dest, Dir dir)
8686
}
8787
}
8888

89-
bool BasicStage::BranchComplete() const
89+
bool BasicStage::GetBranchComplete() const
9090
{
91-
return downstream_->BranchComplete();
91+
return downstream_->GetBranchComplete();
9292
}
9393

94-
bool BasicStage::BranchInactive() const
94+
bool BasicStage::GetBranchInactive() const
9595
{
9696
if (!upstream_)
9797
return false;
98-
return upstream_->BranchInactive();
98+
return upstream_->GetBranchInactive();
9999
}

src/libpisp/backend/tiling/stages.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class Stage
3636
virtual void PushEndUp(int output_end, Dir dir) = 0;
3737
virtual void PushCropDown(Interval interval, Dir dir) = 0;
3838
virtual void CopyOut(void *dest, Dir dir) = 0;
39-
virtual bool BranchComplete() const = 0;
40-
virtual bool BranchInactive() const = 0;
39+
virtual bool GetBranchComplete() const = 0;
40+
virtual bool GetBranchInactive() const = 0;
4141
void MergeRegions(void *dest, void *x_src, void *y_src) const;
4242

4343
protected:
@@ -57,8 +57,8 @@ class BasicStage : public Stage
5757
virtual void SetDownstream(Stage *downstream);
5858
virtual void Reset();
5959
virtual void CopyOut(void *dest, Dir dir);
60-
virtual bool BranchComplete() const;
61-
virtual bool BranchInactive() const;
60+
virtual bool GetBranchComplete() const;
61+
virtual bool GetBranchInactive() const;
6262

6363
protected:
6464
Stage *upstream_;

0 commit comments

Comments
 (0)