void module_free (gpointer mod, const char* module_name) { if(!mod || !module_name) return; mod_free(mod, module_name); }
static void mod_unloadimports(module *md) { int idx=0; if (md->flags&MOD_IMPDONE) return; // flag here to prevent double free from used modules md->flags|=MOD_IMPDONE; while (md->impmod[idx]) idx++; while (--idx>=0) mod_free((u32t)md->impmod[idx]); }
/*---------------------------------------------------------------------------*/ void ethernet_exit(void) { module->exit(); #ifndef STATIC_DRIVER mod_free(module); #endif /* !STATIC_DRIVER */ }
void MD_Exit(void) { // if (md_driver) // { // md_driver->Exit(); // } VC_Exit(); mod_free(sl_buffer); sl_buffer = NULL; }
static void MTM_Cleanup(void) { if(mtmtrk!=NULL) mod_free(mtmtrk); if(mh_mtm!=NULL) mod_free(mh_mtm); }
void evg_compute_unit_free(struct evg_compute_unit_t *compute_unit) { struct heap_t *event_queue; struct evg_uop_t *uop; int i; /* CF Engine - free uops in fetch buffer, instruction buffer, and complete queue */ for (i = 0; i < evg_gpu_max_wavefronts_per_compute_unit; i++) { evg_uop_free(compute_unit->cf_engine.fetch_buffer[i]); evg_uop_free(compute_unit->cf_engine.inst_buffer[i]); } evg_uop_list_free(compute_unit->cf_engine.complete_queue); /* CF Engine - free structures */ free(compute_unit->cf_engine.fetch_buffer); free(compute_unit->cf_engine.inst_buffer); linked_list_free(compute_unit->cf_engine.complete_queue); /* ALU Engine - free uops in event queue (heap) */ event_queue = compute_unit->alu_engine.event_queue; while (heap_count(event_queue)) { heap_extract(event_queue, (void **) &uop); uop->write_subwavefront_count++; if (uop->write_subwavefront_count == uop->subwavefront_count) evg_uop_free(uop); } /* ALU Engine - free uops in fetch queue, instruction buffer, execution buffer, * and event queue. Also free CF instruction currently running. */ evg_uop_list_free(compute_unit->alu_engine.pending_queue); evg_uop_list_free(compute_unit->alu_engine.finished_queue); evg_uop_list_free(compute_unit->alu_engine.fetch_queue); evg_uop_free(compute_unit->alu_engine.inst_buffer); evg_uop_free(compute_unit->alu_engine.exec_buffer); /* ALU Engine - structures */ linked_list_free(compute_unit->alu_engine.pending_queue); linked_list_free(compute_unit->alu_engine.finished_queue); linked_list_free(compute_unit->alu_engine.fetch_queue); heap_free(compute_unit->alu_engine.event_queue); /* TEX Engine - free uop in fetch queue, instruction buffer, write buffer. */ evg_uop_list_free(compute_unit->tex_engine.pending_queue); evg_uop_list_free(compute_unit->tex_engine.finished_queue); evg_uop_list_free(compute_unit->tex_engine.fetch_queue); evg_uop_free(compute_unit->tex_engine.inst_buffer); evg_uop_list_free(compute_unit->tex_engine.load_queue); /* TEX Engine - structures */ linked_list_free(compute_unit->tex_engine.pending_queue); linked_list_free(compute_unit->tex_engine.finished_queue); linked_list_free(compute_unit->tex_engine.fetch_queue); linked_list_free(compute_unit->tex_engine.load_queue); /* Compute unit */ linked_list_free(compute_unit->wavefront_pool); free(compute_unit->work_groups); /* List of mapped work-groups */ mod_free(compute_unit->local_memory); free(compute_unit); }
void frm_sm_free(struct frm_sm_t *sm) { int i; /* Branch Unit */ frm_uop_list_free(sm->branch_unit.issue_buffer); frm_uop_list_free(sm->branch_unit.decode_buffer); frm_uop_list_free(sm->branch_unit.read_buffer); frm_uop_list_free(sm->branch_unit.exec_buffer); frm_uop_list_free(sm->branch_unit.write_buffer); list_free(sm->branch_unit.issue_buffer); list_free(sm->branch_unit.decode_buffer); list_free(sm->branch_unit.read_buffer); list_free(sm->branch_unit.exec_buffer); list_free(sm->branch_unit.write_buffer); /* Global Memory */ frm_uop_list_free(sm->vector_mem_unit.issue_buffer); frm_uop_list_free(sm->vector_mem_unit.decode_buffer); frm_uop_list_free(sm->vector_mem_unit.read_buffer); frm_uop_list_free(sm->vector_mem_unit.mem_buffer); frm_uop_list_free(sm->vector_mem_unit.write_buffer); list_free(sm->vector_mem_unit.issue_buffer); list_free(sm->vector_mem_unit.decode_buffer); list_free(sm->vector_mem_unit.read_buffer); list_free(sm->vector_mem_unit.mem_buffer); list_free(sm->vector_mem_unit.write_buffer); /* Shared Memory */ frm_uop_list_free(sm->lds_unit.issue_buffer); frm_uop_list_free(sm->lds_unit.decode_buffer); frm_uop_list_free(sm->lds_unit.read_buffer); frm_uop_list_free(sm->lds_unit.mem_buffer); frm_uop_list_free(sm->lds_unit.write_buffer); list_free(sm->lds_unit.issue_buffer); list_free(sm->lds_unit.decode_buffer); list_free(sm->lds_unit.read_buffer); list_free(sm->lds_unit.mem_buffer); list_free(sm->lds_unit.write_buffer); /* SIMDs */ for (i = 0; i < sm->num_simd_units; i++) { frm_uop_list_free(sm->simd_units[i]->issue_buffer); frm_uop_list_free(sm->simd_units[i]->decode_buffer); frm_uop_list_free(sm->simd_units[i]->exec_buffer); list_free(sm->simd_units[i]->issue_buffer); list_free(sm->simd_units[i]->decode_buffer); list_free(sm->simd_units[i]->exec_buffer); free(sm->simd_units[i]->subwarp_inst_queue); free(sm->simd_units[i]->wkg_util); free(sm->simd_units[i]->wvf_util); free(sm->simd_units[i]->rdy_util); free(sm->simd_units[i]->occ_util); free(sm->simd_units[i]->wki_util); free(sm->simd_units[i]->act_util); free(sm->simd_units[i]->tot_util); free(sm->simd_units[i]); } free(sm->simd_units); /* Fetch buffers */ for (i = 0; i < sm->num_warp_inst_queues; i++) { frm_uop_list_free(sm->fetch_buffers[i]); list_free(sm->fetch_buffers[i]); } free(sm->fetch_buffers); /* Others */ for (i = 0; i < sm->num_warp_inst_queues; i++) frm_warp_inst_queue_free(sm->warp_inst_queues[i]); free(sm->warp_inst_queues); free(sm->thread_blocks); mod_free(sm->lds_module); free(sm); }
static void S3M_Cleanup(void) { if(s3mbuf!=NULL) mod_free(s3mbuf); if(paraptr!=NULL) mod_free(paraptr); if(mh_s3m!=NULL) mod_free(mh_s3m); }
static void MOD_Cleanup(void) { if(mh_mod!=NULL) mod_free(mh_mod); if(patbuf!=NULL) mod_free(patbuf); }
void si_compute_unit_free(struct si_compute_unit_t *compute_unit) { int i; /* Scalar Unit */ si_uop_list_free(compute_unit->scalar_unit.issue_buffer); si_uop_list_free(compute_unit->scalar_unit.decode_buffer); si_uop_list_free(compute_unit->scalar_unit.read_buffer); si_uop_list_free(compute_unit->scalar_unit.exec_buffer); si_uop_list_free(compute_unit->scalar_unit.write_buffer); si_uop_list_free(compute_unit->scalar_unit.inflight_buffer); list_free(compute_unit->scalar_unit.issue_buffer); list_free(compute_unit->scalar_unit.decode_buffer); list_free(compute_unit->scalar_unit.read_buffer); list_free(compute_unit->scalar_unit.exec_buffer); list_free(compute_unit->scalar_unit.write_buffer); list_free(compute_unit->scalar_unit.inflight_buffer); /* Branch Unit */ si_uop_list_free(compute_unit->branch_unit.issue_buffer); si_uop_list_free(compute_unit->branch_unit.decode_buffer); si_uop_list_free(compute_unit->branch_unit.read_buffer); si_uop_list_free(compute_unit->branch_unit.exec_buffer); si_uop_list_free(compute_unit->branch_unit.write_buffer); list_free(compute_unit->branch_unit.issue_buffer); list_free(compute_unit->branch_unit.decode_buffer); list_free(compute_unit->branch_unit.read_buffer); list_free(compute_unit->branch_unit.exec_buffer); list_free(compute_unit->branch_unit.write_buffer); /* Vector Memory */ si_uop_list_free(compute_unit->vector_mem_unit.issue_buffer); si_uop_list_free(compute_unit->vector_mem_unit.decode_buffer); si_uop_list_free(compute_unit->vector_mem_unit.read_buffer); si_uop_list_free(compute_unit->vector_mem_unit.mem_buffer); si_uop_list_free(compute_unit->vector_mem_unit.write_buffer); list_free(compute_unit->vector_mem_unit.issue_buffer); list_free(compute_unit->vector_mem_unit.decode_buffer); list_free(compute_unit->vector_mem_unit.read_buffer); list_free(compute_unit->vector_mem_unit.mem_buffer); list_free(compute_unit->vector_mem_unit.write_buffer); /* Local Data Share */ si_uop_list_free(compute_unit->lds_unit.issue_buffer); si_uop_list_free(compute_unit->lds_unit.decode_buffer); si_uop_list_free(compute_unit->lds_unit.read_buffer); si_uop_list_free(compute_unit->lds_unit.mem_buffer); si_uop_list_free(compute_unit->lds_unit.write_buffer); list_free(compute_unit->lds_unit.issue_buffer); list_free(compute_unit->lds_unit.decode_buffer); list_free(compute_unit->lds_unit.read_buffer); list_free(compute_unit->lds_unit.mem_buffer); list_free(compute_unit->lds_unit.write_buffer); for (i = 0; i < compute_unit->num_wavefront_pools; i++) { /* SIMDs */ si_uop_list_free(compute_unit->simd_units[i]->issue_buffer); si_uop_list_free(compute_unit->simd_units[i]->decode_buffer); si_uop_list_free(compute_unit->simd_units[i]->exec_buffer); list_free(compute_unit->simd_units[i]->issue_buffer); list_free(compute_unit->simd_units[i]->decode_buffer); list_free(compute_unit->simd_units[i]->exec_buffer); free(compute_unit->simd_units[i]->subwavefront_pool); free(compute_unit->simd_units[i]->wkg_util); free(compute_unit->simd_units[i]->wvf_util); free(compute_unit->simd_units[i]->rdy_util); free(compute_unit->simd_units[i]->occ_util); free(compute_unit->simd_units[i]->wki_util); free(compute_unit->simd_units[i]->act_util); free(compute_unit->simd_units[i]->tot_util); free(compute_unit->simd_units[i]); /* Common for compute unit */ si_uop_list_free(compute_unit->fetch_buffers[i]); list_free(compute_unit->fetch_buffers[i]); si_wavefront_pool_free(compute_unit->wavefront_pools[i]); } free(compute_unit->simd_units); free(compute_unit->wavefront_pools); free(compute_unit->fetch_buffers); free(compute_unit->work_groups); /* List of mapped work-groups */ mod_free(compute_unit->lds_module); free(compute_unit); }
static void XM_Cleanup(void) { if(mh_xm!=NULL) mod_free(mh_xm); }
static void STM_Cleanup(void) { if(mh_stm!=NULL) mod_free(mh_stm); if(stmbuf!=NULL) mod_free(stmbuf); }