Преглед изворни кода

Memory Traces Improvements

Lucas Leandro Nesi пре 6 година
родитељ
комит
756e365e59

+ 10 - 4
src/common/fxt.h

@@ -233,6 +233,8 @@
 #define _STARPU_FUT_DATA_STATE_OWNER      0x5183
 #define _STARPU_FUT_DATA_STATE_SHARED     0x5184
 
+#define _STARPU_FUT_DATA_REQUEST_CREATED   0x5185
+
 extern unsigned long _starpu_job_cnt;
 
 static inline unsigned long _starpu_fxt_get_job_id(void)
@@ -845,14 +847,14 @@ do {										\
 #define _STARPU_TRACE_USER_DEFINED_END		\
 	FUT_DO_PROBE1(_STARPU_FUT_USER_DEFINED_END, _starpu_gettid());
 
-#define _STARPU_TRACE_START_ALLOC(memnode, size, handle)               \
-       FUT_DO_PROBE4(_STARPU_FUT_START_ALLOC, memnode, _starpu_gettid(), size, handle);
+#define _STARPU_TRACE_START_ALLOC(memnode, size, handle, is_prefetch)               \
+       FUT_DO_PROBE5(_STARPU_FUT_START_ALLOC, memnode, _starpu_gettid(), size, handle, is_prefetch);
 
 #define _STARPU_TRACE_END_ALLOC(memnode, handle, r)            \
        FUT_DO_PROBE4(_STARPU_FUT_END_ALLOC, memnode, _starpu_gettid(), handle, r);
 
-#define _STARPU_TRACE_START_ALLOC_REUSE(memnode, size, handle)         \
-       FUT_DO_PROBE4(_STARPU_FUT_START_ALLOC_REUSE, memnode, _starpu_gettid(), size, handle);
+#define _STARPU_TRACE_START_ALLOC_REUSE(memnode, size, handle, is_prefetch)         \
+       FUT_DO_PROBE5(_STARPU_FUT_START_ALLOC_REUSE, memnode, _starpu_gettid(), size, handle, is_prefetch);
 
 #define _STARPU_TRACE_END_ALLOC_REUSE(memnode, handle, r)              \
        FUT_DO_PROBE4(_STARPU_FUT_END_ALLOC_REUSE, memnode, _starpu_gettid(), handle, r);
@@ -1126,6 +1128,9 @@ do {										\
 #define _STARPU_TRACE_DATA_STATE_SHARED(handle, node)          \
        FUT_DO_PROBE2(_STARPU_FUT_DATA_STATE_SHARED, handle, node)
 
+#define _STARPU_TRACE_DATA_REQUEST_CREATED(handle, orig, dest, prio, is_pre)          \
+       FUT_DO_PROBE5(_STARPU_FUT_DATA_REQUEST_CREATED, orig, dest, prio, handle, is_pre)
+
 
 #else // !STARPU_USE_FXT
 
@@ -1250,6 +1255,7 @@ do {										\
 #define _STARPU_TRACE_DATA_STATE_INVALID(handle, node)	do {(void)(handle); (void)(node);} while(0)
 #define _STARPU_TRACE_DATA_STATE_OWNER(handle, node)	do {(void)(handle); (void)(node);} while(0)
 #define _STARPU_TRACE_DATA_STATE_SHARED(handle, node)	do {(void)(handle); (void)(node);} while(0)
+#define _STARPU_TRACE_DATA_REQUEST_CREATED(handle, orig, dest, prio, is_pre) do {(void)(handle); (void)(orig); (void)(dest); (void)(prio); (void)(is_pre);} while(0)
 
 #endif // STARPU_USE_FXT
 

+ 2 - 0
src/datawizard/data_request.c

@@ -133,6 +133,8 @@ struct _starpu_data_request *_starpu_create_data_request(starpu_data_handle_t ha
 
 	_starpu_spin_init(&r->lock);
 
+       _STARPU_TRACE_DATA_REQUEST_CREATED(handle, src_replicate->memory_node, dst_replicate->memory_node, prio, is_prefetch);
+
 	r->origin = origin;
 	r->handle = handle;
 	r->src_replicate = src_replicate;

+ 2 - 2
src/datawizard/memalloc.c

@@ -1344,7 +1344,7 @@ static starpu_ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, st
 	uint32_t footprint = _starpu_compute_data_footprint(handle);
 
 #ifdef STARPU_USE_ALLOCATION_CACHE
-       _STARPU_TRACE_START_ALLOC_REUSE(dst_node, data_size, handle);
+       _STARPU_TRACE_START_ALLOC_REUSE(dst_node, data_size, handle, is_prefetch);
 	if (try_to_find_reusable_mc(dst_node, handle, replicate, footprint))
 	{
 		_starpu_allocation_cache_hit(dst_node);
@@ -1372,7 +1372,7 @@ static starpu_ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, st
 
 	do
 	{
-               _STARPU_TRACE_START_ALLOC(dst_node, data_size, handle);
+               _STARPU_TRACE_START_ALLOC(dst_node, data_size, handle, is_prefetch);
 
 #if defined(STARPU_USE_CUDA) && defined(STARPU_HAVE_CUDA_MEMCPY_PEER) && !defined(STARPU_SIMGRID)
 		if (starpu_node_get_kind(dst_node) == STARPU_CUDA_RAM)

+ 50 - 9
src/debug/traces/starpu_fxt.c

@@ -2427,30 +2427,45 @@ static void handle_memnode_event(struct fxt_ev_64 *ev, struct starpu_fxt_options
 
 static void handle_memnode_event_start_3(struct fxt_ev_64 *ev, struct starpu_fxt_options *options, const char *eventstr){
 	unsigned memnode = ev->param[0];
-	unsigned size = ev->param[1];
-	unsigned long handle = ev->param[2];
+       unsigned size = ev->param[2];
+       unsigned long handle = ev->param[3];
 
 	memnode_event(get_event_time_stamp(ev, options), options->file_prefix, memnode, eventstr, handle, 0, size, memnode, options);
 }
 
+static void handle_memnode_event_start_4(struct fxt_ev_64 *ev, struct starpu_fxt_options *options, const char *eventstr){
+       unsigned memnode = ev->param[0];
+       unsigned dest = ev->param[1];
+       if(strcmp(eventstr, "rc")==0){
+               //If it is a Request Create, use dest normally
+       }else{
+               dest = memnode;
+       }
+       unsigned size = ev->param[2];
+       unsigned long handle = ev->param[3];
+       unsigned prefe = ev->param[4];
+
+       memnode_event(get_event_time_stamp(ev, options), options->file_prefix, memnode, eventstr, handle, prefe, size, dest, options);
+}
+
 static void handle_memnode_event_end_3(struct fxt_ev_64 *ev, struct starpu_fxt_options *options, const char *eventstr){
 	unsigned memnode = ev->param[0];
-	unsigned long handle = ev->param[1];
-	unsigned info = ev->param[2];
+       unsigned long handle = ev->param[2];
+       unsigned info = ev->param[3];
 
 	memnode_event(get_event_time_stamp(ev, options), options->file_prefix, memnode, eventstr, handle, info, 0, memnode, options);
 }
 
 static void handle_memnode_event_start_2(struct fxt_ev_64 *ev, struct starpu_fxt_options *options, const char *eventstr){
 	unsigned memnode = ev->param[0];
-	unsigned long handle = ev->param[1];
+       unsigned long handle = ev->param[2];
 
 	memnode_event(get_event_time_stamp(ev, options), options->file_prefix, memnode, eventstr, handle, 0, 0, memnode, options);
 }
 
 static void handle_memnode_event_end_2(struct fxt_ev_64 *ev, struct starpu_fxt_options *options, const char *eventstr){
 	unsigned memnode = ev->param[0];
-	unsigned long handle = ev->param[1];
+       unsigned long handle = ev->param[2];
 
 	memnode_event(get_event_time_stamp(ev, options), options->file_prefix, memnode, eventstr, handle, 0, 0, memnode, options);
 }
@@ -2547,6 +2562,9 @@ static void handle_job_push(struct fxt_ev_64 *ev, struct starpu_fxt_options *opt
 {
 	double current_timestamp = get_event_time_stamp(ev, options);
 
+       unsigned task = ev->param[0];
+       char *prefix = options->file_prefix;
+       
 	curq_size++;
 
 	_starpu_fxt_component_update_ntasks(nsubmitted, curq_size);
@@ -2558,8 +2576,14 @@ static void handle_job_push(struct fxt_ev_64 *ev, struct starpu_fxt_options *opt
 
 		scheduler_container_alias(container, STARPU_POTI_STR_LEN, options->file_prefix);
 		poti_SetVariable(current_timestamp, container, "nready", (double)curq_size);
+
+               char paje_value[STARPU_POTI_STR_LEN];
+               snprintf(paje_value, sizeof(paje_value), "%u", task);
+               snprintf(container, sizeof(container), "%sp", options->file_prefix);
+               poti_NewEvent(get_event_time_stamp(ev, options), container, "pu", paje_value);
 #else
 		fprintf(out_paje_file, "13	%.9f	%ssched	nready	%f\n", current_timestamp, options->file_prefix, (float)curq_size);
+               fprintf(out_paje_file, "9       %.9f    %s      %sp     %u\n", get_event_time_stamp(ev, options), "pu", prefix, task);
 #endif
 	}
 
@@ -2567,10 +2591,15 @@ static void handle_job_push(struct fxt_ev_64 *ev, struct starpu_fxt_options *opt
 	fprintf(activity_file, "cnt_ready\t%.9f\t%d\n", current_timestamp, curq_size);
 }
 
+
 static void handle_job_pop(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 {
 	double current_timestamp = get_event_time_stamp(ev, options);
 
+       unsigned task = ev->param[0];
+       char *prefix = options->file_prefix;
+       
+
 	curq_size--;
 	nsubmitted--;
 	_starpu_fxt_component_update_ntasks(nsubmitted, curq_size);
@@ -2582,9 +2611,15 @@ static void handle_job_pop(struct fxt_ev_64 *ev, struct starpu_fxt_options *opti
 		scheduler_container_alias(container, STARPU_POTI_STR_LEN, options->file_prefix);
 		poti_SetVariable(current_timestamp, container, "nready", (double)curq_size);
 	poti_SetVariable(current_timestamp, container, "nsubmitted", (double)nsubmitted);
+
+               char paje_value[STARPU_POTI_STR_LEN];
+               snprintf(paje_value, sizeof(paje_value), "%u", task);
+               snprintf(container, sizeof(container), "%sp", options->file_prefix);
+               poti_NewEvent(get_event_time_stamp(ev, options), container, "po", paje_value);
 #else
 		fprintf(out_paje_file, "13	%.9f	%ssched	nready	%f\n", current_timestamp, options->file_prefix, (float)curq_size);
 		fprintf(out_paje_file, "13	%.9f	%ssched	nsubmitted	%f\n", current_timestamp, options->file_prefix, (float)nsubmitted);
+               fprintf(out_paje_file, "9       %.9f    %s      %sp     %u\n", get_event_time_stamp(ev, options), "po", prefix, task);
 #endif
 	}
 
@@ -2593,6 +2628,7 @@ static void handle_job_pop(struct fxt_ev_64 *ev, struct starpu_fxt_options *opti
 		fprintf(activity_file, "cnt_ready\t%.9f\t%d\n", current_timestamp, curq_size);
 		fprintf(activity_file, "cnt_submitted\t%.9f\t%d\n", current_timestamp, nsubmitted);
 	}
+
 }
 
 static void handle_component_new(struct fxt_ev_64 *ev, struct starpu_fxt_options *options STARPU_ATTRIBUTE_UNUSED)
@@ -3603,7 +3639,12 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
 				if (options->memory_states)
 					handle_data_state(&ev, options, "SS");
 				break;
-
+                       case _STARPU_FUT_DATA_REQUEST_CREATED:
+                               if (!options->no_bus && options->memory_states)
+                               {
+                                       handle_memnode_event_start_4(&ev, options, "rc");
+                               }
+                               break;
 			case _STARPU_FUT_DATA_COPY:
 				if (!options->no_bus)
 				     handle_data_copy();
@@ -3665,14 +3706,14 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
 				if (!options->no_bus)
 				{
 					handle_push_memnode_event(&ev, options, "A");
-					handle_memnode_event_start_3(&ev, options, "Al");
+                                       handle_memnode_event_start_4(&ev, options, "Al");
 				}
 				break;
 			case _STARPU_FUT_START_ALLOC_REUSE:
 				if (!options->no_bus)
 				{
 					handle_push_memnode_event(&ev, options, "Ar");
-					handle_memnode_event_start_3(&ev, options, "Alr");
+                                       handle_memnode_event_start_4(&ev, options, "Alr");
 				}
 				break;
 			case _STARPU_FUT_END_ALLOC:

+ 6 - 0
src/debug/traces/starpu_paje.c

@@ -235,6 +235,8 @@ void _starpu_fxt_write_paje_header(FILE *file STARPU_ATTRIBUTE_UNUSED, struct st
 	poti_DefineContainerType("MPICt", "P", "MPI Communication Thread");
 	poti_DefineContainerType("Sc", "P", "Scheduler");
 	poti_DefineEventType("prog_event", "P", "program event type");
+       poti_DefineEventType("pu", "P", "task push");
+       poti_DefineEventType("po", "P", "task pop");
 	poti_DefineEventType("register", "P", "data registration");
 	poti_DefineEventType("unregister", "P", "data unregistration");
 
@@ -244,6 +246,7 @@ void _starpu_fxt_write_paje_header(FILE *file STARPU_ATTRIBUTE_UNUSED, struct st
 	poti_DefineEventType("SO", "Mm", "data state owner");
 	poti_DefineEventType("WU", "Mm", "data wont use");
 	poti_DefineEventType("Al", "Mm", "Allocating Start");
+       poti_DefineEventType("rc", "Mm", "Request Created");
 	poti_DefineEventType("AlE", "Mm", "Allocating End");
 	poti_DefineEventType("Alr", "Mm", "Allocating Async Start");
 	poti_DefineEventType("AlrE", "Mm", "Allocating Async End");
@@ -395,6 +398,8 @@ void _starpu_fxt_write_paje_header(FILE *file STARPU_ATTRIBUTE_UNUSED, struct st
 1       MPICt   P       \"MPI Communication Thread\"              \n\
 1       Sc       P       \"Scheduler State\"                        \n\
 2       prog_event   P       \"program event type\"				\n\
+2       pu   P       \"Task Push\"                             \n\
+2       po   P       \"Task Pop\"                              \n\
 2       register     P       \"data registration\"				\n\
 2       unregister     P       \"data unregistration\"				\n\
 2       user_event   P       \"user event type\"				\n\
@@ -412,6 +417,7 @@ void _starpu_fxt_write_paje_header(FILE *file STARPU_ATTRIBUTE_UNUSED, struct st
 2       SO       Mm \"data state owner\"                            \n\
 2       WU       Mm \"data wont use\"                            \n\
 2       Al       Mm    \"Allocating Start\"    \n\
+2       rc       Mm    \"Request Created\"    \n\
 2       AlE      Mm    \"Allocating End\"    \n\
 2       Alr      Mm    \"Allocating Async Start\"    \n\
 2       AlrE     Mm    \"Allocating Async End\"    \n\