Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/include/simeng/pipeline/LoadStoreQueue.hh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class LoadStoreQueue {
unsigned int maxCombinedSpace, MemoryInterface& memory,
span<PipelineBuffer<std::shared_ptr<Instruction>>> completionSlots,
std::function<void(span<Register>, span<RegisterValue>)> forwardOperands,
std::function<void(const std::shared_ptr<Instruction>&)> raiseException,
bool exclusive = false, uint16_t loadBandwidth = UINT16_MAX,
uint16_t storeBandwidth = UINT16_MAX,
uint16_t permittedRequests = UINT16_MAX,
Expand All @@ -49,6 +50,7 @@ class LoadStoreQueue {
MemoryInterface& memory,
span<PipelineBuffer<std::shared_ptr<Instruction>>> completionSlots,
std::function<void(span<Register>, span<RegisterValue>)> forwardOperands,
std::function<void(const std::shared_ptr<Instruction>&)> raiseException,
bool exclusive = false, uint16_t loadBandwidth = UINT16_MAX,
uint16_t storeBandwidth = UINT16_MAX,
uint16_t permittedRequests = UINT16_MAX,
Expand Down Expand Up @@ -119,6 +121,9 @@ class LoadStoreQueue {
/** A function handler to call to forward the results of a completed load. */
std::function<void(span<Register>, span<RegisterValue>)> forwardOperands_;

/** A function handle called upon exception generation. */
std::function<void(const std::shared_ptr<Instruction>&)> raiseException_;

/** The maximum number of loads that can be in-flight. Undefined if this
* is a combined queue. */
unsigned int maxLoadQueueSpace_;
Expand Down
1 change: 1 addition & 0 deletions src/lib/models/outoforder/Core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Core::Core(MemoryInterface& instructionMemory, MemoryInterface& dataMemory,
[this](auto regs, auto values) {
dispatchIssueUnit_.forwardOperands(regs, values);
},
[](auto uop) { uop->setCommitReady(); },
Comment thread
FinnWilkinson marked this conversation as resolved.
config["LSQ-L1-Interface"]["Exclusive"].as<bool>(),
config["LSQ-L1-Interface"]["Load-Bandwidth"].as<uint16_t>(),
config["LSQ-L1-Interface"]["Store-Bandwidth"].as<uint16_t>(),
Expand Down
3 changes: 3 additions & 0 deletions src/lib/pipeline/FetchUnit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ void FetchUnit::updatePC(uint64_t address) {
}

void FetchUnit::requestFromPC() {
// Do nothing if supplying fetch stream from loop buffer
if (loopBufferState_ == LoopBufferState::SUPPLYING) return;

// Do nothing if buffer already contains enough data
if (bufferedBytes_ >= isa_.getMaxInstructionSize()) return;

Expand Down
18 changes: 18 additions & 0 deletions src/lib/pipeline/LoadStoreQueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ LoadStoreQueue::LoadStoreQueue(
unsigned int maxCombinedSpace, MemoryInterface& memory,
span<PipelineBuffer<std::shared_ptr<Instruction>>> completionSlots,
std::function<void(span<Register>, span<RegisterValue>)> forwardOperands,
std::function<void(const std::shared_ptr<Instruction>&)> raiseException,
bool exclusive, uint16_t loadBandwidth, uint16_t storeBandwidth,
uint16_t permittedRequests, uint16_t permittedLoads,
uint16_t permittedStores)
: completionSlots_(completionSlots),
forwardOperands_(forwardOperands),
raiseException_(raiseException),
maxCombinedSpace_(maxCombinedSpace),
combined_(true),
memory_(memory),
Expand All @@ -40,11 +42,13 @@ LoadStoreQueue::LoadStoreQueue(
MemoryInterface& memory,
span<PipelineBuffer<std::shared_ptr<Instruction>>> completionSlots,
std::function<void(span<Register>, span<RegisterValue>)> forwardOperands,
std::function<void(const std::shared_ptr<Instruction>&)> raiseException,
bool exclusive, uint16_t loadBandwidth, uint16_t storeBandwidth,
uint16_t permittedRequests, uint16_t permittedLoads,
uint16_t permittedStores)
: completionSlots_(completionSlots),
forwardOperands_(forwardOperands),
raiseException_(raiseException),
maxLoadQueueSpace_(maxLoadQueueSpace),
maxStoreQueueSpace_(maxStoreQueueSpace),
combined_(false),
Expand Down Expand Up @@ -100,6 +104,13 @@ void LoadStoreQueue::startLoad(const std::shared_ptr<Instruction>& insn) {
if (ld_addresses.size() == 0) {
// Early execution if not addresses need to be accessed
insn->execute();

if (insn->exceptionEncountered()) {
// Exception; don't pass insn to completedLoads_
raiseException_(insn);
return;
}
Comment thread
FinnWilkinson marked this conversation as resolved.

completedLoads_.push(insn);
} else {
// Create a speculative entry for the load
Expand Down Expand Up @@ -507,6 +518,13 @@ void LoadStoreQueue::tick() {
if (load->hasAllData()) {
// This load has completed
load->execute();

if (load->exceptionEncountered()) {
// Exception; don't pass load to completedLoads_
raiseException_(load);
continue;
}

if (load->isStoreData()) {
supplyStoreData(load);
}
Expand Down
1 change: 1 addition & 0 deletions sst/SimEngMemInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ void SimEngMemInterface::requestWrite(const MemoryAccessTarget& target,
for (StandardMem::Request* req : requests) {
sstMem_->send(req);
}
delete aggrReq;
Comment thread
dANW34V3R marked this conversation as resolved.
}

void SimEngMemInterface::tick() { tickCounter_++; }
Expand Down
37 changes: 20 additions & 17 deletions test/unit/pipeline/LoadStoreQueueTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,22 @@ class LoadStoreQueueTest : public ::testing::TestWithParam<bool> {
LoadStoreQueue getQueue() {
if (GetParam()) {
// Combined queue
return LoadStoreQueue(MAX_COMBINED, dataMemory,
{completionSlots.data(), completionSlots.size()},
[this](auto registers, auto values) {
forwardOperandsHandler.forwardOperands(registers,
values);
});
return LoadStoreQueue(
MAX_COMBINED, dataMemory,
{completionSlots.data(), completionSlots.size()},
[this](auto registers, auto values) {
forwardOperandsHandler.forwardOperands(registers, values);
},
[](auto uop) {});
} else {
// Split queue
return LoadStoreQueue(MAX_LOADS, MAX_STORES, dataMemory,
{completionSlots.data(), completionSlots.size()},
[this](auto registers, auto values) {
forwardOperandsHandler.forwardOperands(registers,
values);
});
return LoadStoreQueue(
MAX_LOADS, MAX_STORES, dataMemory,
{completionSlots.data(), completionSlots.size()},
[this](auto registers, auto values) {
forwardOperandsHandler.forwardOperands(registers, values);
},
[](auto uop) {});
}
}

Expand Down Expand Up @@ -133,9 +135,9 @@ class LoadStoreQueueTest : public ::testing::TestWithParam<bool> {

// Test that a split queue can be constructed correctly
TEST_F(LoadStoreQueueTest, SplitQueue) {
LoadStoreQueue queue =
LoadStoreQueue(MAX_LOADS, MAX_STORES, dataMemory, {nullptr, 0},
[](auto registers, auto values) {});
LoadStoreQueue queue = LoadStoreQueue(
MAX_LOADS, MAX_STORES, dataMemory, {nullptr, 0},
[](auto registers, auto values) {}, [](auto uop) {});

EXPECT_EQ(queue.isCombined(), false);
EXPECT_EQ(queue.getLoadQueueSpace(), MAX_LOADS);
Expand All @@ -145,8 +147,9 @@ TEST_F(LoadStoreQueueTest, SplitQueue) {

// Test that a combined queue can be constructed correctly
TEST_F(LoadStoreQueueTest, CombinedQueue) {
LoadStoreQueue queue = LoadStoreQueue(MAX_COMBINED, dataMemory, {nullptr, 0},
[](auto registers, auto values) {});
LoadStoreQueue queue = LoadStoreQueue(
MAX_COMBINED, dataMemory, {nullptr, 0},
[](auto registers, auto values) {}, [](auto uop) {});

EXPECT_EQ(queue.isCombined(), true);
EXPECT_EQ(queue.getLoadQueueSpace(), MAX_COMBINED);
Expand Down
5 changes: 3 additions & 2 deletions test/unit/pipeline/ReorderBufferTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ class ReorderBufferTest : public testing::Test {
ReorderBufferTest()
: memory{},
rat({{8, 32}}, {64}),
lsq(maxLSQLoads, maxLSQStores, dataMemory, {nullptr, 0},
[](auto registers, auto values) {}),
lsq(
maxLSQLoads, maxLSQStores, dataMemory, {nullptr, 0},
[](auto registers, auto values) {}, [](auto uop) {}),
uop(new MockInstruction),
uop2(new MockInstruction),
uopPtr(uop),
Expand Down