Skip to content

Conversation

@martien-de-jong
Copy link
Collaborator

@martien-de-jong martien-de-jong commented Nov 10, 2025

ConflictBits summarize conflicts between one slot and another, in particular between e.g. XM and X and M
Availability of a format with a particular slot occupation is summarized in a lookup table with the slot set as index.
I have a hunch that the format check is actually not necessary anymore, but now that it is O(1), it doesn't matter much. The reasoning is that the 128 bit format can accommodate all combinations of real slots, and the conflict bits now catch the artificial composite slot constraints.


// Mark a slot as artificial. This will exclude it from any resource
// estimations.
bit Artificial = false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used for e.g. nop slots that are just added to drive format selection, but don't occupy existing slots.

// X -> {XM},
// M -> {XM},
// XM -> {X, M, XM}
// and nothing more. In particular, ConflictBits of A should be equal to its SlotBits
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll extend this test a bit.

@martien-de-jong martien-de-jong force-pushed the martien.slotbits branch 2 times, most recently from cb5c72a to c55211a Compare November 11, 2025 10:24
// CHECK-LABEL: "X",
// CHECK-NEXT: 8,
// CHECK-NEXT: 1,
// CHECK-NEXT: 5,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size=8, slot=0001, conflicts=0101

if (OccupiedSlots & ConflictBits) {
return false;
}
SlotBits NewSlots = OccupiedSlots | SlotInfo->getSlotSet();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are using ConflictBits, why do we still need to check the format (getFormat)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert? and return true?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even a comment to clarify.

@martien-de-jong martien-de-jong force-pushed the martien.slotbits branch 4 times, most recently from 858edf4 to 89e24e9 Compare November 12, 2025 15:46
auto *SlotInfo = FormatInterface->getSlotInfo(Slot);
// ConflictBits is a fast predictor of missing formats
SlotBits ConflictBits = SlotInfo->getConflictSet();
if (OccupiedSlots & ConflictBits) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't the OccupiedSlots be the ConflictBits of a Bundle?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all your comments are covered by this one answer. We keep Slots since they represent the true base class from which the instructions derive. Each instruction has exactly one slot. These are also the slots that are listed in the ISA, in the formats, they define the operands of the format instructions, etc.
The conflicts have no such direct interpretation. I use them for which they were designed, which is as an easy way to detect conflicts given the regular slot occupation bits without scanning the format table.
They end up in FuncUnitWrapper since that is at the heart of the conflict query interface. I cannot enter them in the ScoreBoard, since both X and M would set the XM bit, which would not allow X to be in the same bundle as M.

/// Opcode of the NOP inst. attached to the slot
/// The closure of SlotOccupancy with the computed exclusions,
/// e.g. XM implies X and M
const SlotBits ConflictBits;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need a new SlotBits?
Could we not have a unified SlotOccupancy where XM is properly mapped to X and M occupation?

bool FuncUnitWrapper::operator==(const FuncUnitWrapper &Other) const {
return Required == Other.Required && Reserved == Other.Reserved &&
Slots == Other.Slots && MemoryBanks == Other.MemoryBanks &&
Slots == Other.Slots && Conflicts == Other.Conflicts &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have to check slots and conflicts separately?

@F-Stuckmann
Copy link
Collaborator

Overall I do not understand why we still carry around the regular Slots, when ConflictBits is the more accurate representation?
Could we not reduce this to a single OccupiedSlotbits?

MemoryBankBits MemoryBanks = 0, MemoryObjectsBits ObjectsBits = 0,
SmallVector<int, 2> MemoryAccessCycles = {}) {
return checkConflict(MockScoreboard, &Itins, SchedClass, SlotSet,
return checkConflict(MockScoreboard, &Itins, SchedClass, SlotSet, SlotSet,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we be passing conflictbits here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a small existing mockup where they coincide.

// the slot and format details.
return Slots && Other.Slots &&
!FormatInterface->getPacketFormats().getFormat(Slots | Other.Slots);
!FormatInterface->isFormatAvailable(Slots | Other.Slots);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why aren't we checking conflict bits here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are, at line 131, returning early if we find a conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants