Loading...
Searching...
No Matches
data_request.h
Go to the documentation of this file.
/* StarPU --- Runtime system for heterogeneous multicore architectures.
*
* Copyright (C) 2008-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
* Copyright (C) 2021 Federal University of Rio Grande do Sul (UFRGS)
*
* StarPU is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* StarPU is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU Lesser General Public License in COPYING.LGPL for more details.
*/
/* This one includes us, so make sure to include it first */
#include <datawizard/coherency.h>
#ifndef __DATA_REQUEST_H__
#define __DATA_REQUEST_H__
#include <semaphore.h>
#include <datawizard/copy_driver.h>
#include <common/list.h>
#include <common/prio_list.h>
#include <common/starpu_spinlock.h>
#pragma GCC visibility push(hidden)
/* TODO: This should be tuned according to driver capabilities
* Data interfaces should also have to declare how many asynchronous requests
* they have actually started (think of e.g. csr).
*/
#define MAX_PENDING_REQUESTS_PER_NODE 5
#define MAX_PENDING_PREFETCH_REQUESTS_PER_NODE 2
#define MAX_PENDING_IDLE_REQUESTS_PER_NODE 1
#define MAX_PUSH_TIME 1000
struct _starpu_data_replicate;
struct _starpu_callback_list
{
void (*callback_func)(void *);
void *callback_arg;
struct _starpu_callback_list *next;
};
enum _starpu_data_request_inout
{
_STARPU_DATA_REQUEST_IN, _STARPU_DATA_REQUEST_OUT
};
LIST_TYPE(_starpu_data_request,
struct _starpu_spinlock lock;
unsigned refcnt;
const char *origin;
starpu_data_handle_t handle;
struct _starpu_data_replicate *src_replicate;
struct _starpu_data_replicate *dst_replicate;
unsigned handling_node;
unsigned peer_node;
enum _starpu_data_request_inout inout;
/*
* What the destination node wants to do with the data: write to it,
* read it, or read and write to it. Only in the two latter cases we
* need an actual transfer, the first only needs an allocation.
*
* With mapped buffers, an additional case is mode = 0, which means
* unmapping the buffer.
*/
enum starpu_data_access_mode mode;
struct _starpu_async_channel async_channel;
unsigned completed:1;
unsigned added_ref:1;
unsigned canceled:2;
enum starpu_is_prefetch prefetch:3;
struct starpu_task *task;
unsigned nb_tasks_prefetch;
int prio;
int retval;
unsigned ndeps;
struct _starpu_data_request *next_same_req;
struct _starpu_data_request *next_req[STARPU_MAXNODES+1];
unsigned next_req_count;
struct _starpu_callback_list *callbacks;
unsigned long com_id;
)
PRIO_LIST_TYPE(_starpu_data_request, prio)
LIST_TYPE(_starpu_data_requester,
enum starpu_data_access_mode mode;
unsigned is_requested_by_codelet;
struct _starpu_job *j;
unsigned buffer_index;
int prio;
void (*ready_data_callback)(void *argcb);
void *argcb;
)
PRIO_LIST_TYPE(_starpu_data_requester, prio)
void _starpu_init_data_request_lists(void);
void _starpu_deinit_data_request_lists(void);
void _starpu_post_data_request(struct _starpu_data_request *r);
int _starpu_handle_node_data_requests(unsigned handling_node, unsigned peer_node, enum _starpu_data_request_inout inout, enum _starpu_may_alloc may_alloc, unsigned *pushed);
int _starpu_handle_node_prefetch_requests(unsigned handling_node, unsigned peer_node, enum _starpu_data_request_inout inout, enum _starpu_may_alloc may_alloc, unsigned *pushed);
int _starpu_handle_node_idle_requests(unsigned handling_node, unsigned peer_node, enum _starpu_data_request_inout inout, enum _starpu_may_alloc may_alloc, unsigned *pushed);
int _starpu_handle_pending_node_data_requests(unsigned handling_node, unsigned peer_node, enum _starpu_data_request_inout inout);
int _starpu_handle_all_pending_node_data_requests(unsigned handling_node, unsigned peer_node, enum _starpu_data_request_inout inout);
int _starpu_check_that_no_data_request_exists(unsigned handling_node);
int _starpu_check_that_no_data_request_is_pending(unsigned handling_node, unsigned peer_node, enum _starpu_data_request_inout inout);
struct _starpu_data_request *_starpu_create_data_request(starpu_data_handle_t handle,
struct _starpu_data_replicate *src_replicate,
struct _starpu_data_replicate *dst_replicate,
int handling_node,
enum starpu_data_access_mode mode,
unsigned ndeps,
struct starpu_task *task,
enum starpu_is_prefetch is_prefetch,
int prio,
unsigned is_write_invalidation,
const char *origin) STARPU_ATTRIBUTE_MALLOC;
int _starpu_wait_data_request_completion(struct _starpu_data_request *r, enum _starpu_may_alloc may_alloc);
void _starpu_data_request_append_callback(struct _starpu_data_request *r,
void (*callback_func)(void *),
void *callback_arg);
void _starpu_update_prefetch_status(struct _starpu_data_request *r, enum starpu_is_prefetch prefetch);
#pragma GCC visibility pop
#endif // __DATA_REQUEST_H__
coherency.h
_starpu_data_replicate
Definition coherency.h:47
copy_driver.h
_starpu_async_channel
Definition copy_driver.h:71
list.h
prio_list.h
starpu_spinlock.h
_starpu_spinlock
Definition starpu_spinlock.h:82
_starpu_callback_list
Definition data_request.h:47
_starpu_job
Definition jobs.h:74