Esempio n. 1
0
static struct mod_t *mem_system_command_get_mod(struct list_t *token_list,
	char *command_line)
{
	struct mod_t *mod;

	char *mod_name;

	/* Get module name */
	mem_system_command_expect(token_list, command_line);
	mod_name = str_token_list_first(token_list);

	/* Find module */
	if (!strcasecmp(mod_name, "None"))
		mod = NULL;
	else
	{
		mod = mem_system_get_mod(mod_name);
		if (!mod)
			fatal("%s: %s: invalid module name.\n\t> %s",
				__FUNCTION__, mod_name, command_line);
	}

	/* Return module */
	str_token_list_shift(token_list);
	return mod;
}
Esempio n. 2
0
void evg_mem_config_parse_entry(struct config_t *config, char *section)
{
	char *file_name;
	char *module_name;

	int compute_unit_id;

	struct evg_compute_unit_t *compute_unit;

	/* Get configuration file name */
	file_name = config_get_file_name(config);

	/* Allow these sections in case we quit before reading them. */
	config_var_allow(config, section, "Module");

	/* Read compute unit */
	compute_unit_id = config_read_int(config, section, "ComputeUnit", -1);
	if (compute_unit_id < 0)
		fatal("%s: section [%s]: invalid or missing value for 'ComputeUnit'",
			file_name, section);

	/* Check compute unit boundaries */
	if (compute_unit_id >= evg_gpu_num_compute_units)
	{
		warning("%s: section [%s] ignored, referring to Evergreen compute unit %d.\n"
			"\tThis section refers to a compute unit that does not currently exist.\n"
			"\tPlease review your Evergreen configuration file if this is not the\n"
			"\tdesired behavior.\n",
			file_name, section, compute_unit_id);
		return;
	}

	/* Check that entry has not been assigned before */
	compute_unit = evg_gpu->compute_units[compute_unit_id];
	if (compute_unit->global_memory)
		fatal("%s: section [%s]: entry from compute unit %d already assigned.\n"
			"\tA different [Entry <name>] section in the memory configuration file has already\n"
			"\tassigned an entry for this particular compute unit. Please review your\n"
			"\tconfiguration file to avoid duplicates.\n",
			file_name, section, compute_unit_id);

	/* Read module */
	module_name = config_read_string(config, section, "Module", NULL);
	if (!module_name)
		fatal("%s: section [%s]: variable 'Module' missing.\n"
			"\tPlease run use '--mem-help' for more information on the\n"
			"\tconfiguration file format, or consult the Multi2Sim Guide.\n",
			file_name, section);
	
	/* Assign module */
	compute_unit->global_memory = mem_system_get_mod(module_name);
	if (!compute_unit->global_memory)
		fatal("%s: section [%s]: '%s' is not a valid module name.\n"
			"\tThe given module name must match a module declared in a section\n"
			"\t[Module <name>] in the memory configuration file.\n",
			file_name, section, module_name);
	
	/* Add modules to list of memory entries */
	linked_list_add(evg_emu_arch->mem_entry_mod_list, compute_unit->global_memory);
	
	/* Debug */
	mem_debug("\tEvergreen compute unit %d\n", compute_unit_id);
	mem_debug("\t\tEntry -> %s\n", compute_unit->global_memory->name);
	mem_debug("\n");
}
Esempio n. 3
0
static int x86_acc_func_accDTW (struct x86_ctx_t *ctx)
{
	struct x86_regs_t *regs = ctx->regs;
	struct mem_t *mem = ctx->mem;
	int core; 
	int thread;
	
	unsigned int args_ptr;
	//int x;
	struct arglist func_args;
	/* Read arguments */
	args_ptr = regs->ecx;


	/* Get function info */
	mem_read(mem, args_ptr, sizeof(arglist), &func_args);
	printf("\t\t**sample1 = %p (%p)\n", func_args.sample1, &(func_args.sample1[0][0]));
	printf("\t\tlength1      = %u (%p)\n", func_args.length1, &func_args.length1);
	printf("\t\t**sample2 = %p (%p)\n", func_args.sample2, &(func_args.sample2[0][0]));
	printf("\t\tlength2      = %u (%p)\n", func_args.length2, &func_args.length2);
	printf("\t\ti               = %u (%p)\n", func_args.i, &func_args.i);
	printf("\t\tj               = %u (%p)\n", func_args.j, &func_args.j);
	printf("\t\t*table       = %p (%p)\n", func_args.table, &(func_args.table[0]));

	/***********************************************/

#define L2ONLY
#define WITHACC


#ifdef L2ONLY
	printf ("Cache Behavior Simulation\n");
	char * mod_name = "mod-l2-0";
	X86_THREAD.data_mod = mem_system_get_mod (mod_name);
#endif

#ifdef WITHACC
	struct linked_list_t *sq = X86_THREAD.sq;
	struct linked_list_t *lq = X86_THREAD.lq;
	struct x86_uop_t *store;
	struct x86_uop_t *load;
	int quant = x86_cpu_issue_width;
	unsigned int count1, count2;

	for (count1 = 0; count1 < 124; count1 ++)
	{
		for(count2 = 0; count2 < 124; count2++)
		{
			linked_list_head(sq);
			while (!linked_list_is_end(sq)&& quant )
			{
				store = linked_list_get(sq);
				printf("\n\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n");
				printf("physical addr @ store: %d\n",store->phy_addr);
				assert(store->uinst->opcode == x86_uinst_store);
				if (!store->ready && !x86_reg_file_ready(store))
				{
					linked_list_next(sq);
					continue;
				}


				store->ready = 1;
				printf ("data module kind: %d\n",X86_THREAD.data_mod->kind);
				printf ("data module level: %d\n",X86_THREAD.data_mod->level);
				printf ("data module name: %s\n",X86_THREAD.data_mod->name);
				printf ("data module cache name: %s\n",X86_THREAD.data_mod->cache->name);
				if (!mod_can_access(X86_THREAD.data_mod, store->phy_addr))
				{
					linked_list_next(sq);
					continue;
				}
		
				int i = 3;
				while (i--)
				{
					printf("Store Debug Point 6\n");
					mod_access(X86_THREAD.data_mod, mod_access_store,
						store->phy_addr, NULL, X86_CORE.event_queue, store);
				}
				quant--;
		
				// MMU statistics
				if (*mmu_report_file_name)
					mmu_access_page(store->phy_addr, mmu_access_write);

			}

			quant = x86_cpu_issue_width;

			//printf("Load Simulation ... \n");	
			linked_list_head(lq);
			while (!linked_list_is_end(lq)&& quant )
			{
				load = linked_list_get(lq);
				printf ("physical add @ load: %d\n",load->phy_addr);
				assert(store->uinst->opcode == x86_uinst_store);
				load->ready = 1;
				if (!load->ready && !x86_reg_file_ready(load))
				{
					printf("load debug point 1\n");
					linked_list_next(sq);
					continue;
				}


				load->ready = 1;
				//printf ("physical add: %d\n",load->phy_addr);
				if (!mod_can_access(X86_THREAD.data_mod, store->phy_addr))
				{
					printf("load debug point 2\n");
					linked_list_next(lq);
					continue;
				}
		
				int j = 1;
				while (j--)
				{
					printf("load debug point 3\n");
					mod_access(X86_THREAD.data_mod, mod_access_load,
						load->phy_addr, NULL, X86_CORE.event_queue, load);
				}
				quant--;

				//printf("load debug point 4: quant = %d\n", quant);

				// MMU statistics
				if (*mmu_report_file_name)
					mmu_access_page(load->phy_addr, mmu_access_read);

				// Trace
				x86_trace("x86.inst id=%lld core=%d stg=\"i\"\n",
					load->id_in_core, load->core);
			}
		}
	}
#endif

#ifdef L2ONLY
	mod_name = "mod-dl1-0";
	X86_THREAD.data_mod = mem_system_get_mod (mod_name);
#endif

	/***********************************************/
	int ret = DTWdistance(func_args.sample1, func_args.length1, func_args.sample2, 
		func_args.length2, func_args.i, func_args.j, func_args.table);
	return ret;

}
Esempio n. 4
0
void x86_mem_config_parse_entry(struct config_t *config, char *section)
{
	char *file_name;

	int core;
	int thread;

	int unified_present;
	int data_inst_present;

	char *data_module_name;
	char *inst_module_name;

	/* Get configuration file name */
	file_name = config_get_file_name(config);

	/* Allow these sections in case we quit before reading them. */
	config_var_allow(config, section, "DataModule");
	config_var_allow(config, section, "InstModule");
	config_var_allow(config, section, "Module");

	/* Check right presence of sections */
	unified_present = config_var_exists(config, section, "Module");
	data_inst_present = config_var_exists(config, section, "DataModule") &&
		config_var_exists(config, section, "InstModule");
	if (!(unified_present ^ data_inst_present))
		fatal("%s: section [%s]: invalid combination of modules.\n"
			"\tAn x86 entry to the memory hierarchy needs to specify either a unified\n"
			"\tentry for data and instructions (variable 'Module'), or two separate\n"
			"\tentries for data and instructions (variables 'DataModule' and 'InstModule'),\n"
			"\tbut not both.\n",
			file_name, section);

	/* Read core */
	core = config_read_int(config, section, "Core", -1);
	if (core < 0)
		fatal("%s: section [%s]: invalid or missing value for 'Core'",
			file_name, section);

	/* Read thread */
	thread = config_read_int(config, section, "Thread", -1);
	if (thread < 0)
		fatal("%s: section [%s]: invalid or missing value for 'Thread'",
			file_name, section);

	/* Check bounds */
	if (core >= x86_cpu_num_cores || thread >= x86_cpu_num_threads)
	{
		warning("%s: section [%s] ignored, referring to x86 Core %d, Thread %d.\n"
			"\tThis section refers to a core or thread that does not currently exists.\n"
			"\tPlease review your x86 configuration file if this behavior is not desired.\n",
			file_name, section, core, thread);
		return;
	}

	/* Check that entry has not been assigned before */
	if (X86_THREAD.data_mod || X86_THREAD.inst_mod)
	{
		assert(X86_THREAD.data_mod && X86_THREAD.inst_mod);
		fatal("%s: section [%s]: entry from Core %d, Thread %d already assigned.\n"
			"\tA different [Entry <name>] section in the memory configuration file has already\n"
			"\tassigned an entry for this particular core and thread. Please review your\n"
			"\tconfiguration file to avoid duplicates.\n",
			file_name, section, core, thread);
	}

	/* Read modules */
	if (data_inst_present)
	{
		data_module_name = config_read_string(config, section, "DataModule", NULL);
		inst_module_name = config_read_string(config, section, "InstModule", NULL);
		assert(data_module_name);
		assert(inst_module_name);
	}
	else
	{
		data_module_name = inst_module_name =
			config_read_string(config, section, "Module", NULL);
		assert(data_module_name);
	}

	/* Assign data module */
	X86_THREAD.data_mod = mem_system_get_mod(data_module_name);
	if (!X86_THREAD.data_mod)
		fatal("%s: section [%s]: '%s' is not a valid module name.\n"
			"\tThe given module name must match a module declared in a section\n"
			"\t[Module <name>] in the memory configuration file.\n",
			file_name, section, data_module_name);

	/* Assign instruction module */
	X86_THREAD.inst_mod = mem_system_get_mod(inst_module_name);
	if (!X86_THREAD.inst_mod)
		fatal("%s: section [%s]: '%s' is not a valid module name.\n"
			"\tThe given module name must match a module declared in a section\n"
			"\t[Module <name>] in the memory configuration file.\n",
			file_name, section, inst_module_name);
	
	/* Add modules to entry list */
	linked_list_add(x86_emu_arch->mem_entry_mod_list, X86_THREAD.data_mod);
	if (X86_THREAD.data_mod != X86_THREAD.inst_mod)
		linked_list_add(x86_emu_arch->mem_entry_mod_list, X86_THREAD.inst_mod);

	/* Debug */
	mem_debug("\tx86 Core %d, Thread %d\n", core, thread);
	mem_debug("\t\tEntry for instructions -> %s\n", X86_THREAD.inst_mod->name);
	mem_debug("\t\tEntry for data -> %s\n", X86_THREAD.data_mod->name);
	mem_debug("\n");
}
Esempio n. 5
0
void FrmGpuMemConfigParseEntry(Timing *self, struct config_t *config, char *section)
{
	char *file_name;
	char *module_name;

	int sm_id;

	FrmSM *sm;

	/* Get configuration file name */
	file_name = config_get_file_name(config);

	/* Allow these sections in case we quit before reading them. */
	config_var_allow(config, section, "Module");

	/* Read SM */
	sm_id = config_read_int(config, section, "SM", -1);
	if (sm_id < 0)
		fatal("%s: section [%s]: invalid or missing value for 'SM'",
				file_name, section);

	/* Check SM boundaries */
	if (sm_id >= frm_gpu_num_sms)
	{
		warning("%s: section [%s] ignored, referring to Fermi SM[%d].\n"
				"\tThis section refers to a SM that does not currently exist.\n"
				"\tPlease review your Fermi configuration file if this is not the\n"
				"\tdesired behavior.\n",
				file_name, section, sm_id);
		return;
	}

	/* Check that entry has not been assigned before */
	sm = frm_gpu->sms[sm_id];
	if (sm->global_memory)
		fatal("%s: section [%s]: entry from SM[%d] already assigned.\n"
				"\tA different [Entry <name>] section in the memory configuration file has already\n"
				"\tassigned an entry for this particular SM. Please review your\n"
				"\tconfiguration file to avoid duplicates.\n",
				file_name, section, sm_id);

	/* Read module */
	module_name = config_read_string(config, section, "Module", NULL);
	if (!module_name)
		fatal("%s: section [%s]: variable 'Module' missing.\n"
				"\tPlease run use '--mem-help' for more information on the\n"
				"\tconfiguration file format, or consult the Multi2Sim Guide.\n",
				file_name, section);

	/* Assign module */
	sm->global_memory = mem_system_get_mod(module_name);
	if (!sm->global_memory)
		fatal("%s: section [%s]: '%s' is not a valid module name.\n"
				"\tThe given module name must match a module declared in a section\n"
				"\t[Module <name>] in the memory configuration file.\n",
				file_name, section, module_name);

	/* Add modules to list of memory entries */
	linked_list_add(arch_fermi->mem_entry_mod_list,
			sm->global_memory);

	/* Debug */
	mem_debug("\tFermi SM[%d]\n", sm_id);
	mem_debug("\t\tEntry -> %s\n", sm->global_memory->name);
	mem_debug("\n");
}
Esempio n. 6
0
void SIGpuMemConfigParseEntry(Timing *self, struct config_t *config, char *section)
{
	char *file_name;
	char *vector_module_name;
	char *scalar_module_name;

	int unified_present;
	int separate_present;

	int compute_unit_id;

	struct si_compute_unit_t *compute_unit;

	/* Get configuration file name */
	file_name = config_get_file_name(config);

	/* Allow these sections in case we quit before reading them. */
	config_var_allow(config, section, "DataModule");
	config_var_allow(config, section, "ConstantDataModule");
	config_var_allow(config, section, "Module");

	unified_present = config_var_exists(config, section, "Module");
	separate_present = config_var_exists(config, section, 
		"DataModule") && config_var_exists(config, section, 
		"ConstantDataModule");

	if (!unified_present && !separate_present)
	{
		fatal(
	"%s: section [%s]: variable 'Module' missing.\n"
	"\tPlease run use '--mem-help' for more information on the\n"
	"\tconfiguration file format, or consult the Multi2Sim Guide.\n",
			file_name, section);
	}

	if (!(unified_present ^ separate_present))
	{
		fatal(
	"%s: section [%s]: invalid combination of modules.\n"
	"\tA Southern Islands entry to the memory hierarchy needs to specify\n"
	"\teither a unified entry for vector and scalar caches (variable \n"
	"\t'Module'), or two separate entries for data and scalar (constant)\n"
	"\tdata (variables 'DataModule' and 'ConstantDataModule'), but not\n"
	"\tboth.\n",
			file_name, section);
	}

	/* Read compute unit */
	compute_unit_id = config_read_int(config, section, "ComputeUnit", -1);
	if (compute_unit_id < 0)
	{
		fatal("%s: section [%s]: invalid or missing value for "
			"'ComputeUnit'", file_name, section);
	}

	/* Check compute unit boundaries */
	if (compute_unit_id >= si_gpu_num_compute_units)
	{
		warning(
	"%s: section [%s] ignored, referring to Southern Islands \n"
	"\tcompute unit %d. This section refers to a compute unit that\n" 
	"\tdoes not currently exist. Please review your Southern Islands\n" 
	"\tconfiguration file if this is not the desired behavior.\n",
			file_name, section, compute_unit_id);
		return;
	}

	/* Check that entry has not been assigned before */
	compute_unit = si_gpu->compute_units[compute_unit_id];
	if (compute_unit->vector_cache)
	{
		fatal(
	"%s: section [%s]: entry from compute unit %d already assigned.\n"
	"\tA different [Entry <name>] section in the memory configuration\n" 
	"\tfile has already assigned an entry for this particular compute \n"
	"\tunit. Please review your tconfiguration file to avoid duplicates.\n",
			file_name, section, compute_unit_id);
	}

	/* Read modules */
	if (separate_present)
	{
		vector_module_name = config_read_string(config, section, 
			"DataModule", NULL);
		scalar_module_name = config_read_string(config, section, 
			"ConstantDataModule", NULL);
	}
	else
	{
		vector_module_name = scalar_module_name =
			config_read_string(config, section, "Module", NULL);
	}
	assert(vector_module_name);
	assert(scalar_module_name);
	
	/* Assign modules */
	compute_unit->vector_cache = mem_system_get_mod(vector_module_name);
	if (!compute_unit->vector_cache)
	{
		fatal(
	"%s: section [%s]: '%s' is not a valid module name.\n"
	"\tThe given module name must match a module declared in a section\n"
	"\t[Module <name>] in the memory configuration file.\n",
			file_name, section, vector_module_name);
	}
	compute_unit->scalar_cache = mem_system_get_mod(scalar_module_name);
	if (!compute_unit->scalar_cache)
	{
		fatal(
	"%s: section [%s]: '%s' is not a valid module name.\n"
	"\tThe given module name must match a module declared in a section\n"
	"\t[Module <name>] in the memory configuration file.\n",
			file_name, section, scalar_module_name);
	}
	
	/* Add modules to list of memory entries */
	linked_list_add(arch_southern_islands->mem_entry_mod_list, 
		compute_unit->vector_cache);
	linked_list_add(arch_southern_islands->mem_entry_mod_list, 
		compute_unit->scalar_cache);
	
	/* Debug */
	mem_debug("\tSouthern Islands compute unit %d\n", compute_unit_id);
	mem_debug("\t\tEntry for vector mem -> %s\n", 
		compute_unit->vector_cache->name);
	mem_debug("\t\tEntry for scalar mem -> %s\n", 
		compute_unit->scalar_cache->name);
	mem_debug("\n");
}