Seperated command bus for HBM2

This commit is contained in:
2022-02-14 15:37:32 +01:00
parent 487ef6cb4e
commit e24ec133cc
8 changed files with 116 additions and 37 deletions

View File

@@ -305,10 +305,10 @@ void TlmRecorder::prepareSqlStatements()
"UPDATE Phases SET PhaseEnd = :end WHERE Transact = :trans AND PhaseName = :name";
insertGeneralInfoString =
"INSERT INTO GeneralInfo VALUES"
"(:numberOfTransactions, :end, :numberOfRanks, :numberOfBankGroups, :numberOfBanks, :clk, :unitOfTime, "
":mcconfig, :memspec, :traces, :windowSize, :refreshMaxPostponed, :refreshMaxPulledin, :controllerThread, "
":maxBufferDepth, :per2BankOffset)";
"INSERT INTO GeneralInfo VALUES"
"(:numberOfTransactions, :end, :numberOfRanks, :numberOfBankGroups, :numberOfBanks, :clk, :unitOfTime, "
":mcconfig, :memspec, :traces, :windowSize, :refreshMaxPostponed, :refreshMaxPulledin, :controllerThread, "
":maxBufferDepth, :per2BankOffset, :rowColumnCommandBus)";
insertCommandLengthsString = "INSERT INTO CommandLengths VALUES"
"(:command, :length)";
@@ -365,6 +365,16 @@ void TlmRecorder::insertGeneralInfo()
sqlite3_bind_int(insertGeneralInfoStatement, 15, static_cast<int>(Configuration::getInstance().requestBufferSize));
sqlite3_bind_int(insertGeneralInfoStatement, 16,
static_cast<int>(Configuration::getInstance().memSpec->getPer2BankOffset()));
const auto memoryType = Configuration::getInstance().memSpec->memoryType;
bool rowColumnCommandBus = [memoryType]() -> bool {
if (memoryType == MemSpec::MemoryType::HBM2)
return true;
else
return false;
}();
sqlite3_bind_int(insertGeneralInfoStatement, 17, static_cast<int>(rowColumnCommandBus));
executeSqlStatement(insertGeneralInfoStatement);
}

View File

@@ -189,7 +189,8 @@ private:
" RefreshMaxPulledin INTEGER, \n"
" ControllerThread INTEGER, \n"
" MaxBufferDepth INTEGER, \n"
" Per2BankOffset INTEGER \n"
" Per2BankOffset INTEGER, \n"
" RowColumnCommandBus BOOL \n"
"); \n"
" \n"
"CREATE TABLE CommandLengths( \n"

View File

@@ -62,20 +62,24 @@ struct GeneralInfo
uint64_t controllerThread = UINT64_MAX;
unsigned int maxBufferDepth = 8;
unsigned int per2BankOffset = 1;
bool rowColumnCommandBus = false;
GeneralInfo() = default;
GeneralInfo(uint64_t numberOfTransactions, uint64_t numberOfPhases, Timespan span,
unsigned int numberOfRanks, unsigned int numberOfBankgroups, unsigned int numberOfBanks,
QString description, QString unitOfTime, uint64_t clkPeriod, uint64_t windowSize,
unsigned int refreshMaxPostponed, unsigned int refreshMaxPulledin,
uint64_t controllerThread, unsigned int maxBufferDepth, unsigned int per2BankOffset) :
numberOfTransactions(numberOfTransactions) , numberOfPhases(numberOfPhases), span(span),
numberOfRanks(numberOfRanks), numberOfBankGroups(numberOfBankgroups), numberOfBanks(numberOfBanks),
banksPerRank(numberOfBanks / numberOfRanks), groupsPerRank(numberOfBankgroups / numberOfRanks),
banksPerGroup(numberOfBanks / numberOfBankgroups), description(std::move(description)),
unitOfTime(std::move(unitOfTime)), clkPeriod(clkPeriod), windowSize(windowSize),
refreshMaxPostponed(refreshMaxPostponed), refreshMaxPulledin(refreshMaxPulledin),
controllerThread(controllerThread), maxBufferDepth(maxBufferDepth), per2BankOffset(per2BankOffset) {}
GeneralInfo(uint64_t numberOfTransactions, uint64_t numberOfPhases, Timespan span, unsigned int numberOfRanks,
unsigned int numberOfBankgroups, unsigned int numberOfBanks, QString description, QString unitOfTime,
uint64_t clkPeriod, uint64_t windowSize, unsigned int refreshMaxPostponed,
unsigned int refreshMaxPulledin, uint64_t controllerThread, unsigned int maxBufferDepth,
unsigned int per2BankOffset, bool rowColumnCommandBus)
: numberOfTransactions(numberOfTransactions), numberOfPhases(numberOfPhases), span(span),
numberOfRanks(numberOfRanks), numberOfBankGroups(numberOfBankgroups), numberOfBanks(numberOfBanks),
banksPerRank(numberOfBanks / numberOfRanks), groupsPerRank(numberOfBankgroups / numberOfRanks),
banksPerGroup(numberOfBanks / numberOfBankgroups), description(std::move(description)),
unitOfTime(std::move(unitOfTime)), clkPeriod(clkPeriod), windowSize(windowSize),
refreshMaxPostponed(refreshMaxPostponed), refreshMaxPulledin(refreshMaxPulledin),
controllerThread(controllerThread), maxBufferDepth(maxBufferDepth), per2BankOffset(per2BankOffset),
rowColumnCommandBus(rowColumnCommandBus)
{
}
};
#endif // GENERALINFO_H

View File

@@ -85,7 +85,17 @@ void Phase::draw(QPainter *painter, const QwtScaleMap &xMap,
{
for (const auto &line : drawingProperties.getTracePlotLines())
{
if (line->data.type != AbstractTracePlotLineModel::CommandBusLine)
if (line->data.type == AbstractTracePlotLineModel::RowCommandBusLine)
{
if (isColumnCommand())
continue;
}
else if (line->data.type == AbstractTracePlotLineModel::ColumnCommandBusLine)
{
if (!isColumnCommand())
continue;
}
else if (line->data.type != AbstractTracePlotLineModel::CommandBusLine)
continue;
drawPhaseSymbol(span.Begin(), span.End(), line->data.yVal, false, PhaseSymbol::Hexagon, painter, xMap,
@@ -286,7 +296,9 @@ bool Phase::isSelected(Timespan timespan, double yVal, const TraceDrawingPropert
{
for (const auto &line : drawingProperties.getTracePlotLines())
{
if (line->data.type != AbstractTracePlotLineModel::CommandBusLine)
if ((line->data.type != AbstractTracePlotLineModel::CommandBusLine) &&
(line->data.type != AbstractTracePlotLineModel::RowCommandBusLine) &&
(line->data.type != AbstractTracePlotLineModel::ColumnCommandBusLine))
continue;
if (fabs(yVal - line->data.yVal) <= hexagonHeight / 2)
@@ -310,6 +322,15 @@ bool Phase::isSelected(Timespan timespan, double yVal, const TraceDrawingPropert
return false;
}
bool Phase::isColumnCommand() const
{
if (dynamic_cast<const RD *>(this) || dynamic_cast<const RDA *>(this) || dynamic_cast<const WR *>(this) ||
dynamic_cast<const WRA *>(this))
return true;
else
return false;
}
Phase::PhaseSymbol Phase::getPhaseSymbol() const
{
return PhaseSymbol::Hexagon;

View File

@@ -67,6 +67,7 @@ public:
const QRectF &canvasRect, bool highlight,
const TraceDrawingProperties &drawingProperties) const;
bool isSelected(Timespan timespan, double yVal, const TraceDrawingProperties &drawingproperties) const;
bool isColumnCommand() const;
const Timespan &Span() const
{
return span;

View File

@@ -45,7 +45,7 @@ AbstractTracePlotLineModel::AbstractTracePlotLineModel(const GeneralInfo &genera
: QAbstractItemModel(parent), internalSelectionModel(new QItemSelectionModel(this, this)),
rootNode(std::make_shared<Node>()), numberOfRanks(generalInfo.numberOfRanks),
groupsPerRank(generalInfo.groupsPerRank), banksPerGroup(generalInfo.banksPerGroup),
banksPerRank(generalInfo.banksPerRank)
banksPerRank(generalInfo.banksPerRank), commandBusType(getCommandBusType(generalInfo))
{
createInitialNodes();
}
@@ -75,8 +75,19 @@ void AbstractTracePlotLineModel::createInitialNodes()
for (unsigned int rank = numberOfRanks; rank--;)
addTopLevelNode(createRankGroupNode(rank));
addTopLevelNode(std::unique_ptr<Node>(
new Node({LineType::CommandBusLine, getLabel(LineType::CommandBusLine)}, rootNode.get())));
if (commandBusType == CommandBusType::SingleCommandBus)
{
addTopLevelNode(std::unique_ptr<Node>(
new Node({LineType::CommandBusLine, getLabel(LineType::CommandBusLine)}, rootNode.get())));
}
else // commandBusType == CommandBusType::RowColumnCommandBus
{
addTopLevelNode(std::unique_ptr<Node>(
new Node({LineType::RowCommandBusLine, getLabel(LineType::RowCommandBusLine)}, rootNode.get())));
addTopLevelNode(std::unique_ptr<Node>(
new Node({LineType::ColumnCommandBusLine, getLabel(LineType::ColumnCommandBusLine)}, rootNode.get())));
}
addTopLevelNode(
std::unique_ptr<Node>(new Node({LineType::DataBusLine, getLabel(LineType::DataBusLine)}, rootNode.get())));
}
@@ -319,6 +330,10 @@ QString AbstractTracePlotLineModel::getLabel(LineType type)
return "RESP";
case LineType::CommandBusLine:
return "Command Bus";
case LineType::RowCommandBusLine:
return "Command Bus [R]";
case LineType::ColumnCommandBusLine:
return "Command Bus [C]";
case LineType::DataBusLine:
return "Data Bus";
default:
@@ -336,6 +351,14 @@ QString AbstractTracePlotLineModel::getLabel(unsigned int rank, unsigned int gro
return "RA" + QString::number(rank) + " BG" + QString::number(group) + " BA" + QString::number(bank);
}
AbstractTracePlotLineModel::CommandBusType AbstractTracePlotLineModel::getCommandBusType(const GeneralInfo &generalInfo)
{
if (generalInfo.rowColumnCommandBus)
return CommandBusType::RowColumnCommandBus;
else
return CommandBusType::SingleCommandBus;
}
bool SelectedTracePlotLineModel::removeRows(int row, int count, const QModelIndex &parent)
{
if (parent != QModelIndex())
@@ -404,7 +427,7 @@ bool SelectedTracePlotLineModel::eventFilter(QObject *object, QEvent *event)
if (indexes.count() == 0)
return true;
for (auto &index : indexes)
for (const auto &index : indexes)
{
// Only remove toplevel indexes
if (index.parent() != QModelIndex())
@@ -425,8 +448,6 @@ bool SelectedTracePlotLineModel::eventFilter(QObject *object, QEvent *event)
void SelectedTracePlotLineModel::addIndexesFromAvailableModel(const QModelIndexList &indexes)
{
auto availableModel = qobject_cast<AvailableTracePlotLineModel *>(sender());
for (const auto &index : indexes)
{
auto node = static_cast<const Node *>(index.internalPointer());
@@ -446,7 +467,7 @@ QItemSelectionModel *AbstractTracePlotLineModel::selectionModel() const
QStringList AbstractTracePlotLineModel::mimeTypes() const
{
QStringList types = QAbstractItemModel::mimeTypes();
types << "application/x-tracelinedata";
types << TRACELINE_MIMETYPE;
return types;
}
@@ -465,7 +486,7 @@ QMimeData *AbstractTracePlotLineModel::mimeData(const QModelIndexList &indexes)
}
QMimeData *mimeData = new QMimeData;
mimeData->setData("application/x-tracelinedata", traceLineData);
mimeData->setData(TRACELINE_MIMETYPE, traceLineData);
return mimeData;
}
@@ -477,7 +498,7 @@ bool AbstractTracePlotLineModel::canDropMimeData(const QMimeData *data, Qt::Drop
Q_UNUSED(row);
Q_UNUSED(parent);
if (!data->hasFormat("application/x-tracelinedata"))
if (!data->hasFormat(TRACELINE_MIMETYPE))
return false;
if (column > 0)
@@ -508,7 +529,7 @@ bool AbstractTracePlotLineModel::dropMimeData(const QMimeData *data, Qt::DropAct
{
dropHandled = true;
QByteArray traceLineData = data->data("application/x-tracelinedata");
QByteArray traceLineData = data->data(TRACELINE_MIMETYPE);
QDataStream dataStream(&traceLineData, QIODevice::ReadOnly);
std::vector<std::shared_ptr<Node>> droppedNodes;
@@ -583,6 +604,8 @@ void SelectedTracePlotLineModel::setRootNode(std::shared_ptr<AbstractTracePlotLi
TracePlotLineDataSource::TracePlotLineDataSource(SelectedTracePlotLineModel *selectedModel, QObject *parent)
: selectedModel(selectedModel)
{
Q_UNUSED(parent)
updateModel();
}

View File

@@ -75,6 +75,8 @@ public:
RequestLine,
ResponseLine,
CommandBusLine,
RowCommandBusLine,
ColumnCommandBusLine,
DataBusLine,
RankGroup,
BankLine
@@ -144,6 +146,12 @@ public:
};
protected:
enum class CommandBusType
{
SingleCommandBus,
RowColumnCommandBus
};
QStringList mimeTypes() const override;
QMimeData *mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column,
@@ -161,14 +169,20 @@ protected:
static QString getLabel(unsigned int rank);
static QString getLabel(unsigned int rank, unsigned int group, unsigned int bank);
QItemSelectionModel *internalSelectionModel;
static CommandBusType getCommandBusType(const GeneralInfo &generalInfo);
static constexpr auto TRACELINE_MIMETYPE = "application/x-tracelinedata";
QItemSelectionModel *const internalSelectionModel;
std::shared_ptr<Node> rootNode;
unsigned int numberOfRanks;
unsigned int groupsPerRank;
unsigned int banksPerGroup;
unsigned int banksPerRank;
const unsigned int numberOfRanks;
const unsigned int groupsPerRank;
const unsigned int banksPerGroup;
const unsigned int banksPerRank;
const CommandBusType commandBusType;
};
class AvailableTracePlotLineModel : public AbstractTracePlotLineModel

View File

@@ -316,6 +316,8 @@ GeneralInfo TraceDB::getGeneralInfoFromDB()
unsigned maxBufferDepth = parameter.isValid() ? parameter.toUInt() : 8;
parameter = getParameterFromTable("Per2BankOffset", "GeneralInfo");
unsigned per2BankOffset = parameter.isValid() ? parameter.toUInt() : 1;
parameter = getParameterFromTable("RowColumnCommandBus", "GeneralInfo");
bool rowColumnCommandBus = parameter.isValid() ? parameter.toBool() : false;
uint64_t numberOfPhases = getNumberOfPhases();
@@ -327,9 +329,12 @@ GeneralInfo TraceDB::getGeneralInfoFromDB()
description += "Length of trace: " + prettyFormatTime(traceEnd) + "\n";
description += "Window size: " + QString::number(windowSize) + "\n";
return {numberOfTransactions, numberOfPhases, Timespan(0, traceEnd), numberOfRanks,
numberOfBankGroups, numberOfBanks, description, unitOfTime, clkPeriod, windowSize,
refreshMaxPostponed, refreshMaxPulledin, controllerThread, maxBufferDepth, per2BankOffset};
return {numberOfTransactions, numberOfPhases, Timespan(0, traceEnd),
numberOfRanks, numberOfBankGroups, numberOfBanks,
description, unitOfTime, clkPeriod,
windowSize, refreshMaxPostponed, refreshMaxPulledin,
controllerThread, maxBufferDepth, per2BankOffset,
rowColumnCommandBus};
}
CommandLengths TraceDB::getCommandLengthsFromDB()