// convert input file into .arch and .code1. int pre_process(void) { int result; FILE * input; char * input_name; input = config_get_file(CONFIG_FILE_ID_INPUT); input_name = config_get_file_name(CONFIG_FILE_ID_INPUT); result = pre_recursive_process(input, input_name); line_finish(); return result; }
void evg_mem_config_check(struct config_t *config) { struct evg_compute_unit_t *compute_unit; int compute_unit_id; char *file_name; /* Check that all compute units have an entry to the memory hierarchy. */ file_name = config_get_file_name(config); EVG_GPU_FOREACH_COMPUTE_UNIT(compute_unit_id) { compute_unit = evg_gpu->compute_units[compute_unit_id]; if (!compute_unit->global_memory) fatal("%s: Evergreen compute unit %d has no entry to memory.\n" "\tPlease add a new [Entry <name>] section in your memory configuration\n" "\tfile to associate this compute unit with a memory module.\n", file_name, compute_unit_id); } }
void x86_mem_config_check(struct config_t *config) { int core; int thread; char *file_name; /* Check that all cores/threads have an entry to the memory hierarchy. */ file_name = config_get_file_name(config); X86_CORE_FOR_EACH X86_THREAD_FOR_EACH { if (!X86_THREAD.data_mod || !X86_THREAD.inst_mod) fatal("%s: x86 Core %d, Thread %d lacks a data/instruction entry to memory.\n" "\tPlease add a new [Entry <name>] section in your memory configuration\n" "\tfile to associate this hardware thread with a memory module.\n", file_name, core, thread); } }
void FrmGpuMemConfigCheck(Timing *self, struct config_t *config) { FrmSM *sm; int sm_id; char *file_name; /* Check that all SMs have an entry to the memory hierarchy. */ file_name = config_get_file_name(config); FRM_GPU_FOREACH_SM(sm_id) { sm = frm_gpu->sms[sm_id]; if (!sm->global_memory) fatal("%s: Fermi SM[%d] has no entry to memory.\n" "\tPlease add a new [Entry <name>] section in\n" "\tyour memory configuration file to associate\n" "\tthis SM with a memory module.\n", file_name, sm_id); } }
void SIGpuMemConfigCheck(Timing *self, struct config_t *config) { struct si_compute_unit_t *compute_unit; int compute_unit_id; char *file_name; /* Check that all compute units have an entry to the * memory hierarchy. */ file_name = config_get_file_name(config); SI_GPU_FOREACH_COMPUTE_UNIT(compute_unit_id) { compute_unit = si_gpu->compute_units[compute_unit_id]; if (!compute_unit->vector_cache) { fatal( "%s: Southern Islands compute unit %d has no entry to memory.\n" "\tPlease add a new [Entry <name>] section in your memory\n" "\tconfiguration file to associate this compute unit with a memory\n" "\tmodule.\n", file_name, compute_unit_id); } } }
void X86ReadTraceCacheConfig(struct config_t *config) { char *section; char *file_name; /* Section in configuration file */ section = "TraceCache"; file_name = config_get_file_name(config); /* Read variables */ x86_trace_cache_present = config_read_bool(config, section, "Present", 0); x86_trace_cache_num_sets = config_read_int(config, section, "Sets", 64); x86_trace_cache_assoc = config_read_int(config, section, "Assoc", 4); x86_trace_cache_trace_size = config_read_int(config, section, "TraceSize", 16); x86_trace_cache_branch_max = config_read_int(config, section, "BranchMax", 3); x86_trace_cache_queue_size = config_read_int(config, section, "QueueSize", 32); /* Integrity checks */ if ((x86_trace_cache_num_sets & (x86_trace_cache_num_sets - 1)) || !x86_trace_cache_num_sets) fatal("%s: %s: 'Sets' must be a power of 2 greater than 0", file_name, section); if ((x86_trace_cache_assoc & (x86_trace_cache_assoc - 1)) || !x86_trace_cache_assoc) fatal("%s: %s: 'Assoc' must be a power of 2 greater than 0", file_name, section); if (!x86_trace_cache_trace_size) fatal("%s: %s: Invalid value for 'TraceSize'", file_name, section); if (!x86_trace_cache_branch_max) fatal("%s: %s: Invalid value for 'BranchMax'", file_name, section); if (x86_trace_cache_branch_max > x86_trace_cache_trace_size) fatal("%s: %s: 'BranchMax' must be equal or less than 'TraceSize'", file_name, section); if (x86_trace_cache_branch_max > 31) fatal("%s: %s: Maximum value for 'BranchMax' is 31", file_name, section); }
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"); }
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"); }
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"); }
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"); }