Skip to content

Commit

Permalink
Sync with local branch, phase 2 done
Browse files Browse the repository at this point in the history
  • Loading branch information
HongshiTan committed Aug 28, 2020
1 parent 5ee345a commit c512fd2
Show file tree
Hide file tree
Showing 25 changed files with 433 additions and 58 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ csr
*.xclbin
*.sh
tmp_fpga_top
code_gen
tmp_para
code_gen
para_gen
2 changes: 1 addition & 1 deletion application/ar/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main(int argc, char **argv) {
endStamp = getCurrentTimestamp();

/* profile */
accelratorProfile(runCounter, runCounter, &graphDataInfo, endStamp - startStamp);
acceleratorProfile(runCounter, runCounter, &graphDataInfo, endStamp - startStamp);
}
acceleratorDeinit();

Expand Down
2 changes: 1 addition & 1 deletion application/bfs/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int main(int argc, char **argv) {


/* profile */
accelratorProfile(runCounter, runCounter, &graphDataInfo, endStamp - startStamp);
acceleratorProfile(runCounter, runCounter, &graphDataInfo, endStamp - startStamp);
runCounter++;
}
acceleratorDeinit();
Expand Down
2 changes: 1 addition & 1 deletion application/cc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char **argv) {
}

/* profile */
accelratorProfile(runCounter, runCounter, &graphDataInfo, endStamp - startStamp);
acceleratorProfile(runCounter, runCounter, &graphDataInfo, endStamp - startStamp);
runCounter ++;
}
acceleratorDeinit();
Expand Down
3 changes: 2 additions & 1 deletion application/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ else
HOST_SRCS += $(APPCONFIG)/main.cpp
endif

HOST_SRCS += ./libgraph/memory/he_mem.cpp
HOST_SRCS += ./libgraph/memory/he_mem.cpp
HOST_SRCS += ./libgraph/memory/he_mapping.cpp
HOST_SRCS += ./libgraph/host_graph_sw_mem.cpp
HOST_SRCS += ./libgraph/host_graph_sw_partition.cpp
HOST_SRCS += ./libgraph/host_graph_sw_kernel.cpp
Expand Down
2 changes: 1 addition & 1 deletion docs/api_details.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,6 @@ inline prop_t applyCalculation( prop_t tProp,
|acceleratorDataPrepare | load the graph data |
|acceleratorDataPreprocess | graph partitioning |
|acceleratorSuperStep | process all of the partitions once |
|accelratorProfile | profile the execution time and verify the result |
|acceleratorProfile | profile the execution time and verify the result |
|acceleratorDeinit | release all the dynamic resources |
2 changes: 1 addition & 1 deletion docs/verification.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Verification

As we have a cache in ThunderGP, the static verification method (emu-sw) can not be used for the verification and validation of our framework. ThunderGP provides an automatic verification scheme, by calling the function ```accelratorProfile``` after the calcuation, the verification will be automatically performed, and it will output the difference between the result from hardware unit and the golden. Currently it only supports the verification on the fisrt super step.
As we have a cache in ThunderGP, the static verification method (emu-sw) can not be used for the verification and validation of our framework. ThunderGP provides an automatic verification scheme, by calling the function ```acceleratorProfile``` after the calcuation, the verification will be automatically performed, and it will output the difference between the result from hardware unit and the golden. Currently it only supports the verification on the fisrt super step.
1 change: 1 addition & 0 deletions libfpga/fpga_edge_prop.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void edgePropCouple (
break;
}
}
clear_stream(input);
clear_stream(edgeProp);
}

Expand Down
15 changes: 15 additions & 0 deletions libfpga/generator/devices/device_common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef __DEVICE_COMMON_H__
#define __DEVICE_COMMON_H__

typedef struct
{
int slr_id;
int luts;
int ffs;
int dsp;
int bram;
int uram;
} slr_resource_info_t;


#endif /* __DEVICE_COMMON_H__ */
36 changes: 36 additions & 0 deletions libfpga/generator/devices/xilinx_u200_xdma_201830_2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "device_common.h"

const char * board_name = "u200";

const slr_resource_info_t slrs[] =
{
{
.slr_id = 0,
.luts = 354831,
.ffs = 723372,
.dsp = 2265,
.bram = 638,
.uram = 320,
},
{
.slr_id = 1,
.luts = 159854,
.ffs = 331711,
.dsp = 1317,
.bram = 326,
.uram = 160,
},
{
.slr_id = 2,
.luts = 354962,
.ffs = 723353,
.dsp = 2265,
.bram = 638,
.uram = 320,
},
};

const int mem_cu_map[] =
{
0, 1, 1, 2
};
45 changes: 45 additions & 0 deletions libfpga/generator/devices/xilinx_u250_xdma_201830_2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "device_common.h"

const char * board_name = "u250";

const slr_resource_info_t slrs[] =
{
{
.slr_id = 0,
.luts = 345171,
.ffs = 704801,
.dsp = 2877,
.bram = 500,
.uram = 320,
},
{
.slr_id = 1,
.luts = 344533,
.ffs = 702517,
.dsp = 2877,
.bram = 500,
.uram = 320,
},
{
.slr_id = 2,
.luts = 344878,
.ffs = 703253,
.dsp = 2877,
.bram = 500,
.uram = 0,
},
{
.slr_id = 3,
.luts = 345158,
.ffs = 703761,
.dsp = 2877,
.bram = 500,
.uram = 320,
},
};

const int mem_cu_map[] =
{
0, 1, 2, 3
};

36 changes: 36 additions & 0 deletions libfpga/generator/devices/xilinx_vcu1525_xdma_201830_1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "device_common.h"

const char * board_name = "vcu1525";

const slr_resource_info_t slrs[] =
{
{
.slr_id = 0,
.luts = 354830,
.ffs = 723371,
.dsp = 2265,
.bram = 638,
.uram = 320,
},
{
.slr_id = 1,
.luts = 159088,
.ffs = 329162,
.dsp = 1317,
.bram = 326,
.uram = 160,
},
{
.slr_id = 2,
.luts = 354934,
.ffs = 723328,
.dsp = 2265,
.bram = 638,
.uram = 320,
},
};

const int mem_cu_map[] =
{
0, 1, 1, 2
};
7 changes: 0 additions & 7 deletions libfpga/generator/gs_gen.cpp

This file was deleted.

13 changes: 13 additions & 0 deletions libfpga/generator/para_gen.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <stdio.h>

#include "device_common.h"

#ifndef DEVICE_HEADER
#error "no board name"
#endif

#include DEVICE_HEADER

int main(int argc, char **argv) {
printf("%s \n", board_name);
}
6 changes: 6 additions & 0 deletions libfpga/generator/parser.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ code_gen:
./code_gen libfpga/common/apply_top.cpp tmp_fpga_top/apply_top
./code_gen libfpga/common/scatter_gather_top.cpp tmp_fpga_top/scatter_gather_top

.PHONY: para_gen
para_gen:
rm -rf tmp_para
mkdir -p tmp_para
g++ -static-libstdc++ -I libfpga/generator/devices -DDEVICE_HEADER="$(DEVICES).h" $(CODE_GEN_PATH)/para_gen.cpp -o para_gen

14 changes: 12 additions & 2 deletions libgraph/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,20 @@

#include "global_config.h"

#define EXPAND(x) x


#define FLAG_SET (1u)
#define FLAG_RESET (0u)
#define STRINGIFY_MACRO(x) STR(x)
#define STR(x) #x

#define CONCAT4(n1, n2, n3, n4) STRINGIFY_MACRO(EXPAND(n1)EXPAND(n2)EXPAND(n3)EXPAND(n4))

#define CAT_SECOND_LEVLE(x, y) x ## y
#define VAR_CONCAT2(x, y) CAT_SECOND_LEVLE(x, y)


#define FLAG_SET (1u)
#define FLAG_RESET (0u)


#if 1
Expand Down
4 changes: 2 additions & 2 deletions libgraph/default_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int main(int argc, char **argv) {
/* for verification */
acceleratorCModelDataPreprocess(&graphDataInfo);

for (int runCounter = 0 ; runCounter < 2 ; runCounter ++)
for (int runCounter = 0 ; runCounter < 3 ; runCounter ++)
{
double startStamp, endStamp;
startStamp = getCurrentTimestamp();
Expand All @@ -61,7 +61,7 @@ int main(int argc, char **argv) {
acceleratorCModelSuperStep(runCounter, &graphDataInfo);

/* for profile */
accelratorProfile(runCounter, runCounter, &graphDataInfo, endStamp - startStamp);
acceleratorProfile(runCounter, runCounter, &graphDataInfo, endStamp - startStamp);
}
acceleratorDeinit();

Expand Down
6 changes: 5 additions & 1 deletion libgraph/host_graph_sw.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void* acceleratorQueryRegister(void);
prop_t* acceleratorQueryProperty(int step);


int accelratorProfile (int superStep, int runCounter, graphInfo *info, double exeTime);
int acceleratorProfile (int superStep, int runCounter, graphInfo *info, double exeTime);

int acceleratorCModelDataPreprocess(graphInfo *info);

Expand All @@ -168,6 +168,10 @@ int dataPrepareProperty(graphInfo *info);
int getStartIndex(void);


inline int getCuIDbyInterface(int order)
{
return he_get_interface_id(order);
}


double getCurrentTimestamp(void);
Expand Down
20 changes: 7 additions & 13 deletions libgraph/host_graph_sw_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ void setGsKernel(int partId, int superStep, graphInfo *info)
#if HW_EMU_DEBUG
edgeEnd = HW_EMU_DEBUG_SIZE;
#endif
//DEBUG_PRINTF("gs task in cu [%d] info:\n", i);
//DEBUG_PRINTF("\tedge %d %d \n", 0, edgeEnd);
//DEBUG_PRINTF("\tsink %d %d \n", sinkStart, sinkEnd);

clSetKernelArg(gsHandler->kernel, argvi++, sizeof(cl_mem), get_cl_mem_pointer(partition->edgeHead.id));
clSetKernelArg(gsHandler->kernel, argvi++, sizeof(cl_mem), get_cl_mem_pointer(gsHandler->prop[currentPropId].id));
clSetKernelArg(gsHandler->kernel, argvi++, sizeof(cl_mem), get_cl_mem_pointer(partition->edgeTail.id));
Expand All @@ -105,10 +103,6 @@ void setGsKernel(int partId, int superStep, graphInfo *info)

#if CUSTOMIZE_APPLY == 0

const int applyGlobalMemoryIndex[] =
{
2, 1, 0, 3
};

void setApplyKernel(int partId, int superStep, graphInfo *info)
{
Expand All @@ -127,20 +121,20 @@ void setApplyKernel(int partId, int superStep, graphInfo *info)
int offset = p_partition->dstVertexStart;


clSetKernelArg(applyHandler->kernel, argvi++, sizeof(cl_mem), get_cl_mem_pointer(getGatherScatter(applyGlobalMemoryIndex[0])->prop[currentPropId].id));
clSetKernelArg(applyHandler->kernel, argvi++, sizeof(cl_mem), get_cl_mem_pointer(getGatherScatter(getCuIDbyInterface(0))->prop[currentPropId].id));

for (int i = 0; i < 4; i++)
for (int i = 0; i < SUB_PARTITION_NUM; i++)
{
clSetKernelArg(applyHandler->kernel, argvi++, sizeof(cl_mem),
get_cl_mem_pointer(getSubPartition(partId * SUB_PARTITION_NUM + applyGlobalMemoryIndex[i])->tmpProp.id)
get_cl_mem_pointer(getSubPartition(partId * SUB_PARTITION_NUM + getCuIDbyInterface(i))->tmpProp.id)
);
}
for (int i = 0; i < 4; i++)
for (int i = 0; i < SUB_PARTITION_NUM; i++)
{
clSetKernelArg(applyHandler->kernel, argvi++, sizeof(cl_mem),
get_cl_mem_pointer(getGatherScatter(applyGlobalMemoryIndex[i])->prop[updatePropId].id)
get_cl_mem_pointer(getGatherScatter(getCuIDbyInterface(i))->prop[updatePropId].id)
);
he_set_dirty(getGatherScatter(applyGlobalMemoryIndex[i])->prop[updatePropId].id);
he_set_dirty(getGatherScatter(getCuIDbyInterface(i))->prop[updatePropId].id);
}

#if HAVE_APPLY_OUTDEG
Expand Down

0 comments on commit c512fd2

Please sign in to comment.