Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
Make max q depth a global definition
Browse files Browse the repository at this point in the history
  • Loading branch information
qizzz committed Sep 14, 2023
1 parent cd846f9 commit cc040f1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
4 changes: 3 additions & 1 deletion DPDPU/Common/Include/Protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
#define RING_BUFFER_REQUEST_META_DATA_SIZE 128
#define RING_BUFFER_RESPONSE_META_DATA_SIZE 128

#define DDS_MAX_OUTSTANDING_IO 256

//
// Check a few parameters at the compile time
//
Expand All @@ -87,5 +89,5 @@ assert_static_protocol(DDS_RESPONSE_RING_BYTES % DDS_CACHE_LINE_SIZE == 0, 5);
#pragma warning(pop)
#endif

#define DDS_BACKEND_ADDR "172.16.1.3"
#define DDS_BACKEND_ADDR "172.16.3.72"
#define DDS_BACKEND_PORT 4242
2 changes: 1 addition & 1 deletion DPDPU/Common/Source/Host/DMABuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ DMABuffer::Allocate(
// Post receives to allow backend to write responses
//
//
for (int i = 0; i != DDS_FRONTEND_MAX_OUTSTANDING; i++) {
for (int i = 0; i != DDS_MAX_OUTSTANDING_IO; i++) {
RDMC_PostReceive(QPair, MsgSgl, 1, MSG_CTXT);
}

Expand Down
12 changes: 6 additions & 6 deletions DPDPU/StorageEngine/DDSApplication/DDSApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ void BenchmarkIO(
}

cout << "Benchmarking reads..." << endl;
char* readBuffer = new char[PAGE_SIZE * DDS_FRONTEND_MAX_OUTSTANDING];
memset(readBuffer, 0, sizeof(char) * PAGE_SIZE * DDS_FRONTEND_MAX_OUTSTANDING);
char* readBuffer = new char[PAGE_SIZE * DDS_MAX_OUTSTANDING_IO];
memset(readBuffer, 0, sizeof(char) * PAGE_SIZE * DDS_MAX_OUTSTANDING_IO);
completedIOs = 0;
profiler.Start();
for (size_t i = 0; i != totalIOs; i++) {
result = Store.ReadFile(
FileId,
&readBuffer[(i % DDS_FRONTEND_MAX_OUTSTANDING) * PAGE_SIZE],
&readBuffer[(i % DDS_MAX_OUTSTANDING_IO) * PAGE_SIZE],
PAGE_SIZE,
&bytesServiced,
DummyCallback,
Expand Down Expand Up @@ -240,8 +240,8 @@ BenchmarkIOWithPolling(
}

cout << "Benchmarking reads..." << endl;
char* readBuffer = new char[PAGE_SIZE * DDS_FRONTEND_MAX_OUTSTANDING];
memset(readBuffer, 0, sizeof(char) * PAGE_SIZE * DDS_FRONTEND_MAX_OUTSTANDING);
char* readBuffer = new char[PAGE_SIZE * DDS_MAX_OUTSTANDING_IO];
memset(readBuffer, 0, sizeof(char) * PAGE_SIZE * DDS_MAX_OUTSTANDING_IO);

pollWorker = new thread(
[&Store, FileId, totalIOs]
Expand All @@ -252,7 +252,7 @@ BenchmarkIOWithPolling(
for (size_t i = 0; i != totalIOs; i++) {
result = Store.ReadFile(
FileId,
&readBuffer[(i % DDS_FRONTEND_MAX_OUTSTANDING) * PAGE_SIZE],
&readBuffer[(i % DDS_MAX_OUTSTANDING_IO) * PAGE_SIZE],
PAGE_SIZE,
&bytesServiced,
NULL,
Expand Down
28 changes: 14 additions & 14 deletions DPDPU/StorageEngine/DDSFrontEnd/DDSFrontEnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace DDS_FrontEnd {
//
//
PollT::PollT() {
for (size_t i = 0; i != DDS_FRONTEND_MAX_OUTSTANDING; i++) {
for (size_t i = 0; i != DDS_MAX_OUTSTANDING_IO; i++) {
OutstandingRequests[i] = nullptr;
}
#if BACKEND_TYPE == BACKEND_TYPE_DPU
Expand Down Expand Up @@ -133,7 +133,7 @@ DDSFrontEnd::~DDSFrontEnd() {
#if BACKEND_TYPE == BACKEND_TYPE_DPU
AllPolls[p]->DestroyDMABuffer();
#endif
for (size_t i = 0; i != DDS_FRONTEND_MAX_OUTSTANDING; i++) {
for (size_t i = 0; i != DDS_MAX_OUTSTANDING_IO; i++) {
delete AllPolls[p]->OutstandingRequests[i];
}

Expand Down Expand Up @@ -185,7 +185,7 @@ DDSFrontEnd::Initialize() {
//
//
PollT* poll = new PollT();
for (size_t i = 0; i != DDS_FRONTEND_MAX_OUTSTANDING; i++) {
for (size_t i = 0; i != DDS_MAX_OUTSTANDING_IO; i++) {
poll->OutstandingRequests[i] = new FileIOT();
if (!poll->OutstandingRequests[i]) {
fprintf(stderr, "%s [error]: Failed to allocate a file I/O object\n", __func__);
Expand Down Expand Up @@ -573,7 +573,7 @@ DDSFrontEnd::ReadFile(

PollT* poll = AllPolls[AllFiles[FileId]->PollId];
size_t mySlot = poll->NextRequestSlot.fetch_add(1, std::memory_order_relaxed);
mySlot %= DDS_FRONTEND_MAX_OUTSTANDING;
mySlot %= DDS_MAX_OUTSTANDING_IO;
FileIOT* pIO = poll->OutstandingRequests[mySlot];

//
Expand Down Expand Up @@ -643,7 +643,7 @@ DDSFrontEnd::ReadFile(
PollIdT pollId = AllFiles[FileId]->PollId;
PollT* poll = AllPolls[pollId];
size_t mySlot = poll->NextRequestSlot.fetch_add(1, std::memory_order_relaxed);
mySlot %= DDS_FRONTEND_MAX_OUTSTANDING;
mySlot %= DDS_MAX_OUTSTANDING_IO;
FileIOT* pIO = poll->OutstandingRequests[mySlot];

bool expectedAvail = true;
Expand Down Expand Up @@ -729,7 +729,7 @@ DDSFrontEnd::ReadFileScatter(

PollT* poll = AllPolls[AllFiles[FileId]->PollId];
size_t mySlot = poll->NextRequestSlot.fetch_add(1, std::memory_order_relaxed);
mySlot %= DDS_FRONTEND_MAX_OUTSTANDING;
mySlot %= DDS_MAX_OUTSTANDING_IO;
FileIOT* pIO = poll->OutstandingRequests[mySlot];

//
Expand Down Expand Up @@ -799,7 +799,7 @@ DDSFrontEnd::ReadFileScatter(
PollIdT pollId = AllFiles[FileId]->PollId;
PollT* poll = AllPolls[pollId];
size_t mySlot = poll->NextRequestSlot.fetch_add(1, std::memory_order_relaxed);
mySlot %= DDS_FRONTEND_MAX_OUTSTANDING;
mySlot %= DDS_MAX_OUTSTANDING_IO;
FileIOT* pIO = poll->OutstandingRequests[mySlot];

bool expectedAvail = true;
Expand Down Expand Up @@ -886,7 +886,7 @@ DDSFrontEnd::WriteFile(

PollT* poll = AllPolls[AllFiles[FileId]->PollId];
size_t mySlot = poll->NextRequestSlot.fetch_add(1, std::memory_order_relaxed);
mySlot %= DDS_FRONTEND_MAX_OUTSTANDING;
mySlot %= DDS_MAX_OUTSTANDING_IO;
FileIOT* pIO = poll->OutstandingRequests[mySlot];

//
Expand Down Expand Up @@ -957,7 +957,7 @@ DDSFrontEnd::WriteFile(
PollIdT pollId = AllFiles[FileId]->PollId;
PollT* poll = AllPolls[pollId];
size_t mySlot = poll->NextRequestSlot.fetch_add(1, std::memory_order_relaxed);
mySlot %= DDS_FRONTEND_MAX_OUTSTANDING;
mySlot %= DDS_MAX_OUTSTANDING_IO;
FileIOT* pIO = poll->OutstandingRequests[mySlot];

bool expectedAvail = true;
Expand Down Expand Up @@ -1043,7 +1043,7 @@ DDSFrontEnd::WriteFileGather(

PollT* poll = AllPolls[AllFiles[FileId]->PollId];
size_t mySlot = poll->NextRequestSlot.fetch_add(1, std::memory_order_relaxed);
mySlot %= DDS_FRONTEND_MAX_OUTSTANDING;
mySlot %= DDS_MAX_OUTSTANDING_IO;
FileIOT* pIO = poll->OutstandingRequests[mySlot];

//
Expand Down Expand Up @@ -1120,7 +1120,7 @@ DDSFrontEnd::WriteFileGather(
PollIdT pollId = AllFiles[FileId]->PollId;
PollT* poll = AllPolls[pollId];
size_t mySlot = poll->NextRequestSlot.fetch_add(1, std::memory_order_relaxed);
mySlot %= DDS_FRONTEND_MAX_OUTSTANDING;
mySlot %= DDS_MAX_OUTSTANDING_IO;
FileIOT* pIO = poll->OutstandingRequests[mySlot];

bool expectedAvail = true;
Expand Down Expand Up @@ -1445,7 +1445,7 @@ DDSFrontEnd::PollCreate(
}

PollT* poll = new PollT();
for (size_t i = 0; i != DDS_FRONTEND_MAX_OUTSTANDING; i++) {
for (size_t i = 0; i != DDS_MAX_OUTSTANDING_IO; i++) {
poll->OutstandingRequests[i] = new FileIOT();
}
poll->NextRequestSlot = 0;
Expand Down Expand Up @@ -1473,7 +1473,7 @@ DDSFrontEnd::PollDelete(
return DDS_ERROR_CODE_INVALID_POLL_DELETION;
}

for (size_t i = 0; i != DDS_FRONTEND_MAX_OUTSTANDING; i++) {
for (size_t i = 0; i != DDS_MAX_OUTSTANDING_IO; i++) {
delete poll->OutstandingRequests[i];
}
delete poll;
Expand Down Expand Up @@ -1528,7 +1528,7 @@ DDSFrontEnd::PollWait(
size_t sleepTimeInUs = 1;

while (true) {
for (size_t i = 0; i != DDS_FRONTEND_MAX_OUTSTANDING; i++) {
for (size_t i = 0; i != DDS_MAX_OUTSTANDING_IO; i++) {
FileIOT* io = poll->OutstandingRequests[i];

bool expectedCompletion = true;
Expand Down
2 changes: 0 additions & 2 deletions DPDPU/StorageEngine/DDSFrontEnd/DDSFrontEndConfig.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#define DDS_FRONTEND_MAX_OUTSTANDING 128

#define BACKEND_TYPE_LOCAL_MEMORY 0
#define BACKEND_TYPE_DPU 1
#define BACKEND_TYPE BACKEND_TYPE_DPU
Expand Down
2 changes: 1 addition & 1 deletion DPDPU/StorageEngine/DDSFrontEnd/DDSFrontEndTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ typedef struct FileIOT {
//
//
typedef struct PollT {
FileIOT* OutstandingRequests[DDS_FRONTEND_MAX_OUTSTANDING];
FileIOT* OutstandingRequests[DDS_MAX_OUTSTANDING_IO];
Atomic<size_t> NextRequestSlot;
#if BACKEND_TYPE == BACKEND_TYPE_DPU
DMABuffer* MsgBuffer;
Expand Down

0 comments on commit cc040f1

Please sign in to comment.