Add expandBoundingBox method to API (#1395)

* Add expandBoundingBox method to API

* Update API documentation
This commit is contained in:
Miodrag Milanović 2024-11-26 10:13:41 +01:00 committed by GitHub
parent 55035465aa
commit 0e69425794
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 36 additions and 8 deletions

View File

@ -147,6 +147,9 @@ template <typename R> struct ArchAPI : BaseCtx
virtual bool isClusterStrict(const CellInfo *cell) const = 0;
virtual bool getClusterPlacement(ClusterId cluster, BelId root_bel,
std::vector<std::pair<CellInfo *, BelId>> &placement) const = 0;
// Routing methods
virtual void expandBoundingBox(BoundingBox &bb) const = 0;
// Flow methods
virtual bool pack() = 0;
virtual bool place() = 0;

View File

@ -442,6 +442,14 @@ template <typename R> struct BaseArch : ArchAPI<R>
});
}
// Routing methods
virtual void expandBoundingBox(BoundingBox &bb) const override {
bb.x0 = std::max(bb.x0 - 1, 0);
bb.y0 = std::max(bb.y0 - 1, 0);
bb.x1 = std::min(bb.x1 + 1, this->getGridDimX());
bb.y1 = std::min(bb.y1 + 1, this->getGridDimY());
}
// Flow methods
virtual void assignArchInfo() override {};

View File

@ -1013,14 +1013,7 @@ struct Router2
++net_data.fail_count;
if ((net_data.fail_count % 3) == 0) {
// Every three times a net fails to route, expand the bounding box to increase the search space
#ifndef ARCH_MISTRAL
// This patch seems to make thing worse for CycloneV, as it slows down the resolution of TD congestion,
// disable it
net_data.bb.x0 = std::max(net_data.bb.x0 - 1, 0);
net_data.bb.y0 = std::max(net_data.bb.y0 - 1, 0);
net_data.bb.x1 = std::min(net_data.bb.x1 + 1, ctx->getGridDimX());
net_data.bb.y1 = std::min(net_data.bb.y1 + 1, ctx->getGridDimY());
#endif
ctx->expandBoundingBox(net_data.bb);
}
}
}

View File

@ -765,3 +765,12 @@ Returns `true` if the cell **must** be placed according to the cluster; for exam
Gets an exact placement of the cluster, with the root cell placed on or near `root_bel` (and always within the same tile). Returns false if no placement is viable, otherwise returns `true` and populates `placement` with a list of cells inside the cluster and bels they should be placed at.
This approach of allowing architectures to define cluster placements enables easier handling of irregular fabrics than requiring strict and constant x, y and z offsets.
Router Methods
---------------
### void expandBoundingBox(BoundingBox &bb) const
As part of `router2` implementation, during congestion update, every third time a net fails to route, this method is executed to expand the bounding box to increase the search space.
Default implementation expands by one tile in each direction.

View File

@ -707,6 +707,10 @@ struct Arch : BaseArch<ArchRanges>
DecalXY getPipDecal(PipId pip) const override;
DecalXY getGroupDecal(GroupId group) const override;
// ------------------------------------------------
// Routing methods
void expandBoundingBox(BoundingBox &bb) const override { uarch->expandBoundingBox(bb); };
// ------------------------------------------------
bool pack() override;

View File

@ -85,6 +85,11 @@ bool HimbaechelAPI::getClusterPlacement(ClusterId cluster, BelId root_bel,
return ctx->BaseArch::getClusterPlacement(cluster, root_bel, placement);
}
void HimbaechelAPI::expandBoundingBox(BoundingBox &bb) const
{
ctx->BaseArch::expandBoundingBox(bb);
}
HimbaechelArch *HimbaechelArch::list_head;
HimbaechelArch::HimbaechelArch(const std::string &name) : name(name)
{

View File

@ -114,6 +114,8 @@ struct HimbaechelAPI
virtual void drawPip(std::vector<GraphicElement> &g,GraphicElement::style_t style, Loc loc,
WireId src, IdString src_type, int32_t src_id, WireId dst, IdString dst_type, int32_t dst_id) {};
// Routing methods
virtual void expandBoundingBox(BoundingBox &bb) const;
// --- Flow hooks ---
virtual void pack() {}; // replaces the pack function
// Called before and after main placement and routing

View File

@ -450,6 +450,10 @@ struct Arch : BaseArch<ArchRanges>
BelBucketId getBelBucketForCellType(IdString cell_type) const override;
BelBucketId getBelBucketForBel(BelId bel) const override;
// -------------------------------------------------
// Expanding bounding box seems to make thing worse for CycloneV
// as it slows down the resolution of TD congestion, disabling it
void expandBoundingBox(BoundingBox &bb) const override {};
// -------------------------------------------------
void assignArchInfo() override;