This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:microsoft/dpdpu into main
- Loading branch information
Showing
6 changed files
with
157 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "CacheTable.h" | ||
#include "OffloadTypes.h" | ||
#include <stdio.h> | ||
|
||
struct MessageHeader { | ||
long long TimeSend; | ||
uint16_t BatchId; | ||
uint16_t FileId; | ||
uint64_t Offset; | ||
int Length; | ||
}; | ||
|
||
void OffloadFunc( | ||
void* Msg, | ||
RequestDescriptorT* Req, | ||
CacheTableT* CacheTable, | ||
OffloadWorkRequest* ReadOp | ||
) { | ||
struct MessageHeader* msg = (struct MessageHeader*)(((char*)Msg) + Req->Offset); | ||
ReadOp->FileId = msg->FileId; | ||
ReadOp->Bytes = msg->Length; | ||
ReadOp->Offset = msg->Offset; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "CacheTable.h" | ||
#include "OffloadTypes.h" | ||
#include <stdio.h> | ||
|
||
void OffloadFunc( | ||
void* Msg, | ||
RequestDescriptorT* Req, | ||
CacheTableT* CacheTable, | ||
OffloadWorkRequest* ReadOp | ||
) { | ||
// Msg is basically one packet, descriptor's offset and bytes point to the data we are interested in | ||
//printf("offload func got msg: %s, offset: %hu, bytes: %hu\n", Msg, Req->Offset, Req->Bytes); | ||
// ReadOp->RequestId = ??; // it's already assigned when we got it, don't touch | ||
printf("request id: %u\n", ReadOp->RequestId); | ||
ReadOp->FileId = 0; // always 0th file | ||
ReadOp->Bytes = 8192; | ||
ReadOp->Offset = 8192; | ||
/*CacheItemT Item = {.Key = ReadOp->RequestId, .Version = 0, .FileId = 0, .Offset = 0, .Size = 8192}; | ||
int ret = AddToCacheTable(&Item); | ||
CacheItemT* GotItem = LookUpCacheTable(&ReadOp->RequestId); | ||
if (GotItem == NULL) { | ||
printf("LookUpCacheTable returned NULL!!!\n"); | ||
return; | ||
} | ||
printf("Got item back, key %u, offset %u, size %u\n", GotItem->Key, GotItem->Offset, GotItem->Size); | ||
// GotItem = NULL; | ||
DeleteFromCacheTable(&ReadOp->RequestId); | ||
GotItem = LookUpCacheTable(&ReadOp->RequestId); | ||
if (GotItem != NULL) { | ||
printf("LookUpCacheTable returned non NULL after delete!!!\n"); | ||
return; | ||
}*/ | ||
|
||
//// once the read request is prepared it will eventually be completed and send the raw read content back to tcp client | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "CacheTable.h" | ||
#include "OffloadTypes.h" | ||
#include <stdio.h> | ||
|
||
struct MessageHeader { | ||
long long TimeSend; | ||
uint16_t BatchId; | ||
uint16_t FileId; | ||
uint64_t Offset; | ||
int Length; | ||
}; | ||
|
||
void OffloadPred( | ||
void* Msg, | ||
uint16_t Bytes, | ||
CacheTableT* CacheTable, | ||
RequestDescriptorT* ReqsForHost, | ||
RequestDescriptorT* ReqsForDPU, | ||
uint8_t* NumReqsForHost, | ||
uint8_t* NumReqsForDPU | ||
) { | ||
const uint16_t reqSize = sizeof(struct MessageHeader); | ||
const int numReqsForDPU = Bytes / reqSize; | ||
|
||
*NumReqsForHost = 0; | ||
*NumReqsForDPU = numReqsForDPU; | ||
|
||
for (int i = 0; i != numReqsForDPU; i++) { | ||
ReqsForDPU[i].Offset = i * reqSize; | ||
ReqsForDPU[i].Bytes = reqSize; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "CacheTable.h" | ||
#include "OffloadTypes.h" | ||
#include <stdio.h> | ||
|
||
/* struct MessageHeader { | ||
bool OffloadedToDPU; | ||
bool LastMessage; | ||
int MessageSize; | ||
long long TimeSend; | ||
}; | ||
void OffloadPred( | ||
void* Msg, | ||
uint16_t Bytes, | ||
CacheTableT* CacheTable, | ||
RequestDescriptorT* ReqsForHost, | ||
RequestDescriptorT* ReqsForDPU, | ||
uint8_t* NumReqsForHost, | ||
uint8_t* NumReqsForDPU | ||
) { | ||
*NumReqsForHost = 1; | ||
*NumReqsForDPU = 0; | ||
ReqsForHost[0].Offset = 0; | ||
ReqsForHost[0].Bytes = Bytes; | ||
} */ | ||
|
||
void OffloadPred( | ||
void* Msg, | ||
uint16_t Bytes, | ||
CacheTableT* CacheTable, | ||
RequestDescriptorT* ReqsForHost, | ||
RequestDescriptorT* ReqsForDPU, | ||
uint8_t* NumReqsForHost, | ||
uint8_t* NumReqsForDPU | ||
) { | ||
*NumReqsForHost = 0; | ||
*NumReqsForDPU = 1; | ||
ReqsForDPU[0].Offset = 0; | ||
ReqsForDPU[0].Bytes = Bytes; | ||
printf("offload pred got msg, bytes: %hu\n", Bytes); | ||
} |