|
@@ -47,7 +47,7 @@
|
|
|
//#define STARPU_MAXFPGADEVS 4
|
|
|
/* the number of FPGA devices */
|
|
|
static unsigned nfpgafpgas = -1;
|
|
|
-static fpgaDeviceProp props[STARPU_MAXFPGADEVS];
|
|
|
+static struct starpu_fpga_device_properties props[STARPU_MAXFPGADEVS];
|
|
|
static size_t global_mem[STARPU_MAXFPGADEVS] = { 128ULL*1024*1024*1024 };
|
|
|
|
|
|
static void _starpu_fpga_limit_global_mem(unsigned );
|
|
@@ -72,9 +72,9 @@ void _starpu_init_fpga()
|
|
|
#if 0
|
|
|
int fpga_allocate_memory(fpga_mem *ptr, size_t size)
|
|
|
{
|
|
|
-//This allocates BYTES
|
|
|
+ //This allocates BYTES
|
|
|
char *msg1="You asked to allocate ";
|
|
|
-// printf(KCYN "%s%d*%d\n" KBLU, msg1,size,sizeof(unsigned));
|
|
|
+ //printf(KCYN "%s%d*%d\n" KBLU, msg1,size,sizeof(unsigned));
|
|
|
printf(FPGA_OK "%s%lu bytes\n" NORMAL, msg1,size);
|
|
|
|
|
|
*ptr =(fpga_mem) malloc(size);
|
|
@@ -86,9 +86,9 @@ int fpga_allocate_memory(fpga_mem *ptr, size_t size)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-int fpgaGetDeviceProperties(fpgaDeviceProp *props,unsigned devid)
|
|
|
+int starpu_fpga_get_device_properties(struct starpu_fpga_device_properties *props, unsigned devid)
|
|
|
{
|
|
|
-//TODO
|
|
|
+ //TODO
|
|
|
props->totalGlobalMem=1*1024*1024;
|
|
|
props->concurrentKernels=4;
|
|
|
props->name="Fpga_Props_Name";
|
|
@@ -111,7 +111,7 @@ static void _starpu_fpga_limit_global_mem(unsigned devid)
|
|
|
{
|
|
|
starpu_ssize_t limit=-1;
|
|
|
|
|
|
-//TODO
|
|
|
+ //TODO
|
|
|
limit = starpu_get_env_number("STARPU_LIMIT_FPGA_MEM");
|
|
|
if(limit != -1)
|
|
|
global_mem[devid] = limit*1024*1024;
|
|
@@ -124,35 +124,33 @@ static size_t _starpu_fpga_get_global_mem_size(unsigned devid)
|
|
|
|
|
|
static void init_fpga_worker_context(unsigned workerid)
|
|
|
{
|
|
|
-// starpu_fpgaStreamCreate(&streams[devid][i]);
|
|
|
+ //starpu_fpgaStreamCreate(&streams[devid][i]);
|
|
|
}
|
|
|
|
|
|
static void init_device_context(unsigned devid)
|
|
|
{
|
|
|
-// int workerid;
|
|
|
unsigned i;
|
|
|
-//TODO: fpgaSetDevice
|
|
|
- fpgaSetDevice(devid);
|
|
|
-
|
|
|
-//TODO: fpgaGetDeviceProperties
|
|
|
- fpgaGetDeviceProperties(&props[devid], devid);
|
|
|
-//TODO: Do we need the streams? I think no
|
|
|
-// cures = starpu_fpgaStreamCreate(&in_transfer_streams[devid]);
|
|
|
-// cures = starpu_fpgaStreamCreate(&out_transfer_streams[devid]);
|
|
|
+ //TODO: starpu_fpga_set_device
|
|
|
+ starpu_fpga_set_device(devid);
|
|
|
+
|
|
|
+ starpu_fpga_get_device_properties(&props[devid], devid);
|
|
|
+ //TODO: Do we need the streams? I think no
|
|
|
+ //cures = starpu_fpgaStreamCreate(&in_transfer_streams[devid]);
|
|
|
+ //cures = starpu_fpgaStreamCreate(&out_transfer_streams[devid]);
|
|
|
for (i = 0; i < nfpgafpgas; i++)
|
|
|
{
|
|
|
-// starpu_fpgaStreamCreate(&in_peer_transfer_streams[i][devid]);
|
|
|
-// starpu_fpgaStreamCreate(&out_peer_transfer_streams[devid][i]);
|
|
|
+ //starpu_fpgaStreamCreate(&in_peer_transfer_streams[i][devid]);
|
|
|
+ //starpu_fpgaStreamCreate(&out_peer_transfer_streams[devid][i]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int _starpu_fpga_driver_init(struct _starpu_worker *worker)
|
|
|
{
|
|
|
int devid = worker->devid;
|
|
|
-//fpga_msg("successful till here");
|
|
|
+ //fpga_msg("successful till here");
|
|
|
_starpu_driver_start(worker, _STARPU_FUT_CPU_KEY, 1);
|
|
|
/* FIXME: when we have NUMA support, properly turn node number into NUMA node number */
|
|
|
-// TODO: drop test when we allocated a memory node for fpga
|
|
|
+ // TODO: drop test when we allocated a memory node for fpga
|
|
|
if (worker->memory_node != STARPU_MAIN_RAM)
|
|
|
_starpu_memory_manager_set_global_memory_size(worker->memory_node, _starpu_fpga_get_global_mem_size(worker->devid));
|
|
|
|
|
@@ -199,7 +197,7 @@ static int execute_job_on_fpga(struct _starpu_job *j, struct starpu_task *worker
|
|
|
{
|
|
|
_starpu_cl_func_t func = _starpu_task_get_fpga_nth_implementation(cl, j->nimpl);
|
|
|
//char *kernel_type = _starpu_task_get_fpga_kernel_type_nth_implementation(cl, j->nimpl);
|
|
|
-//printf("chanel reserved: %d \n",chnl);
|
|
|
+ //printf("chanel reserved: %d \n",chnl);
|
|
|
|
|
|
STARPU_ASSERT_MSG(func, "when STARPU_FPGA is defined in 'where', fpga_func or fpga_funcs has to be defined");
|
|
|
if (_starpu_get_disable_kernels() <= 0)
|
|
@@ -369,10 +367,10 @@ uintptr_t _starpu_fpga_allocate_memory(unsigned dst_node, size_t size, int flags
|
|
|
STARPU_ASSERT(devid == 0); // For now
|
|
|
|
|
|
/* 0 would be seen as NULL, i.e. allocation failed... */
|
|
|
-// FIXME: Maxeler FPGAs want 192-byte alignment
|
|
|
+ // FIXME: Maxeler FPGAs want 192-byte alignment
|
|
|
static fpga_mem current_address = 8192*192;
|
|
|
fpga_mem addr;
|
|
|
-// TODO: vérifier si current_address + size > taille de la LMEm
|
|
|
+ // TODO: vérifier si current_address + size > taille de la LMEm
|
|
|
addr = current_address;
|
|
|
current_address += size;
|
|
|
printf("fpga mem returned from allocation @: %p - %p\n",addr, addr + size);
|