parsec icon indicating copy to clipboard operation
parsec copied to clipboard

Release function for parsec_object_t

Open devreal opened this issue 10 months ago • 6 comments

Description

With https://github.com/ICLDisco/parsec/pull/694 the GPU task structure becomes a proper PaRSEC object and carefully avoid calling PARSEC_OBJ_RELEASE on it to avoid freeing it explicitly and instead add a callback to free it. The regular task structure is already an object but we don't really utilize the object management macros because we want to utilize free lists, so we have a dedicated callback for its release. Data copies have to be heap allocated because they are freed so we cannot use free lists for them.

Describe the solution you'd like

Instead of calling free in PARSEC_OBJ_RELEASE we should unify the above approaches and add a release callback to the parsec_object_t that allows the entity allocating it to determine the way it should be freed. Then we can PARSEC_OBJ_RELEASE the object and the object will go back where it came from, e.g., a free-list. This avoids the careful dance we do with parsec_task_t and parsec_gpu_task_t and would allow the use of free lists for parsec_data_copy_t.

Describe alternatives you've considered

The current approach of type-specific deallocators is fragile and does not cover all objects that could benefit from non-standard allocation methods.

devreal avatar Jan 09 '25 19:01 devreal