陳韋任 via llvm-dev
2017-Apr-21 15:22 UTC
[llvm-dev] Question about Hexagon VLIWResourceModel::reserveResources
Hi All, I am reading Hexagon's VLIW scheduler source code, and have a question about VLIWResourceModel::reserveResources.>From what I understand, it checks if a SU can be put in currentPacket. Intuitively, if current Packet is full, isResourceAvailable should return false immediately. However, I see the code below: --- // If packet is now full, reset the state so in the next cycle // we start fresh. if (Packet.size() >= SchedModel->getIssueWidth()) { ResourcesModel->clearResources(); savePacket(); Packet.clear(); TotalPackets++; startNewCycle = true; } --- I don't see reserveResources check if the Packet is full already, and it seems possible that we have Packet.size >SchedModel->getIssueWidth(). Is the Packet valid? Thanks. Regards, chenwj -- Wei-Ren Chen (陳韋任) Homepage: https://people.cs.nctu.edu.tw/~chenwj
Krzysztof Parzyszek via llvm-dev
2017-Apr-21 15:49 UTC
[llvm-dev] Question about Hexagon VLIWResourceModel::reserveResources
I'd have to look at the code in more detail, but the packet checks are only approximate. There are several instructions that are not checked against resource availability, so adding them may indeed exceed the packet size limit. The precise checks are a lot more complex. One thing to keep track of are "constant extenders", which are special instructions that only hold immediate values for operands that wouldn't otherwise fit in the encoding of the instruction that uses them. -Krzysztof On 4/21/2017 10:22 AM, 陳韋任 via llvm-dev wrote:> Hi All, > > I am reading Hexagon's VLIW scheduler source code, and have a > question about VLIWResourceModel::reserveResources. > From what I understand, it checks if a SU can be put in current > Packet. Intuitively, if current Packet is full, isResourceAvailable > should return false immediately. However, I see the code below: > > --- > > // If packet is now full, reset the state so in the next cycle > // we start fresh. > if (Packet.size() >= SchedModel->getIssueWidth()) { > ResourcesModel->clearResources(); > savePacket(); > Packet.clear(); > TotalPackets++; > startNewCycle = true; > } > > --- > > I don't see reserveResources check if the Packet is full already, > and it seems possible that we have Packet.size >> SchedModel->getIssueWidth(). > Is the Packet valid? > > Thanks. > > Regards, > chenwj >-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation