struct evg_opencl_kernel_t *evg_opencl_kernel_create() { struct evg_opencl_kernel_t *kernel; int i; /* Initialize */ kernel = xcalloc(1, sizeof(struct evg_opencl_kernel_t)); kernel->id = evg_opencl_repo_new_object_id(evg_emu->opencl_repo, evg_opencl_object_kernel); kernel->ref_count = 1; kernel->arg_list = list_create(); /* Create the UAV-to-physical-address lookup lists */ kernel->uav_read_list = list_create_with_size(12); /* FIXME Repalce with MAX_UAVS? */ kernel->uav_write_list = list_create_with_size(12); /* FIXME Repalce with MAX_UAVS? */ kernel->constant_buffer_list = list_create_with_size(25); /* For constant buffers (128 to 153) */ /* FIXME Replace with new list functionality */ for (i = 0; i < 12; i++) { list_add(kernel->uav_read_list, NULL); list_add(kernel->uav_write_list, NULL); } for (i = 0; i < 25; i++) list_add(kernel->constant_buffer_list, NULL); /* Return */ evg_opencl_repo_add_object(evg_emu->opencl_repo, kernel); return kernel; }
struct net_node_t *net_add_bus(struct net_t *net, int bandwidth, char *name, int lanes) { struct net_node_t *node; /* Create node */ node = net_node_create(net, net_node_bus, /* kind */ net->node_count, /* index */ 0, /* input_buffer_size */ 0, /* output_buffer_size */ bandwidth, name, NULL); /* user_data */ /* Add to list */ net->node_count++; list_add(net->node_list, node); node->bus_lane_list = list_create_with_size(4); node->src_buffer_list = list_create_with_size(4); node->dst_buffer_list = list_create_with_size(4); for (int i = 0; i < lanes; i++) { net_node_add_bus_lane(node); } /* Return */ return node; }
struct net_node_t *net_node_create(struct net_t *net, enum net_node_kind_t kind, int index, int input_buffer_size, int output_buffer_size, int bandwidth, char *name, void *user_data) { struct net_node_t *node; /* Fields */ node = xcalloc(1, sizeof(struct net_node_t)); node->net = net; node->name = xstrdup(name); node->kind = kind; node->index = index; node->user_data = user_data; node->bandwidth = bandwidth; node->input_buffer_size = input_buffer_size; node->output_buffer_size = output_buffer_size; if (kind != net_node_end && bandwidth < 1) panic("%s: invalid bandwidth", __FUNCTION__); if (net_get_node_by_name(net, name)) fatal("%s: duplicated node name.\n%s", net->name, net_err_node_name_duplicate); /* Lists of ports */ node->output_buffer_list = list_create_with_size(4); node->input_buffer_list = list_create_with_size(4); return node; }
struct net_graph_t *net_graph_create(struct net_t *net) { struct net_graph_t *graph; graph = xcalloc(1, sizeof(struct net_graph_t)); graph->net = net; graph->edge_list = list_create_with_size(4); graph->vertex_list = list_create_with_size(4); return graph; }
void x86_uop_queue_init() { int core; int thread; X86_CORE_FOR_EACH X86_THREAD_FOR_EACH X86_THREAD.uop_queue = list_create_with_size(x86_uop_queue_size); }
/* Create vgpu structure based on an input trace */ struct vgpu_t *vgpu_create(char *trace_file_name) { struct vgpu_t *vgpu; int err; /* Create it */ vgpu = calloc(1, sizeof(struct vgpu_t)); /* Open trace file */ snprintf(vgpu->trace_file_name, sizeof vgpu->trace_file_name, "%s", trace_file_name); vgpu->trace_file = fopen(trace_file_name, "rt"); if (!vgpu->trace_file) { snprintf(vgpu_trace_err, sizeof vgpu_trace_err, "%s: cannot open file", trace_file_name); free(vgpu); return NULL; } /* Open status file */ snprintf(vgpu->state_file_name, sizeof vgpu->state_file_name, "%s.status", trace_file_name); vgpu->state_file = fopen(vgpu->state_file_name, "w+b"); if (!vgpu->state_file) { snprintf(vgpu_trace_err, sizeof vgpu_trace_err, "%s: cannot create state file", vgpu->state_file_name); fclose(vgpu->trace_file); free(vgpu); return NULL; } /* Create status text */ vgpu->status_text_size = MAX_STRING_SIZE; vgpu->status_text = calloc(1, MAX_STRING_SIZE); /* Create lists */ vgpu->state_checkpoint_list = list_create_with_size(100); vgpu->kernel_source_strings = list_create(); vgpu->compute_unit_list = list_create(); vgpu->work_group_list = list_create(); vgpu->pending_work_group_list = list_create(); vgpu->finished_work_group_list = list_create(); /* Parse trace file */ err = vgpu_trace_parse(vgpu); if (err) { /* FIXME: free stuff created before (including what 'vgpu_trace_parse' created) */ return NULL; } /* Return it */ return vgpu; }
struct evg_opencl_program_t *evg_opencl_program_create() { struct evg_opencl_program_t *program; int i; /* Initialize */ program = xcalloc(1, sizeof(struct evg_opencl_program_t)); program->id = evg_opencl_repo_new_object_id(evg_emu->opencl_repo, evg_opencl_object_program); program->ref_count = 1; /* Constant buffers encoded in ELF file */ program->constant_buffer_list = list_create_with_size(25); for (i = 0; i < 25; i++) list_add(program->constant_buffer_list, NULL); /* Return */ evg_opencl_repo_add_object(evg_emu->opencl_repo, program); return program; }
struct dram_bank_info_t *dram_bank_info_create(unsigned int channel_id, unsigned int rank_id, unsigned int bank_id, unsigned int request_queue_depth) { struct dram_bank_info_t *info; /* Initialize */ info = xcalloc(1, sizeof(struct dram_bank_info_t)); info->channel_id = channel_id; info->rank_id = rank_id; info->bank_id = bank_id; info->request_queue_depth = request_queue_depth; /* Create request queue */ info->request_queue = list_create_with_size(request_queue_depth); /* Create command queue */ info->command_queue = list_create(); /* Return */ return info; }
/* If no initial size specified, create a list with 8 elements. */ struct list_t *list_create(void) { return list_create_with_size(8); }
void X86ThreadInitFetchQueue(X86Thread *self) { self->fetch_queue = list_create_with_size(x86_fetch_queue_size); }