minimalloc icon indicating copy to clipboard operation
minimalloc copied to clipboard

Offset filed of buffer dose not work

Open Gxiandy opened this issue 1 year ago • 7 comments

Hi,

This is excellent work! We try to use it to solve some memory allocation problems. We found that when we set a value to the offset filed of a buffer (which will be regard as a fixed position buffer according to the annotation), the solver will re-allocate this buffer instead of using the offet we provided.

Did I use it wrong? Or is this still a todo feature?

Gxiandy avatar Jul 12 '24 05:07 Gxiandy

Ah, yes that optional<Offset> field is confusing ... when reading solution files, we use it to store the final (fixed) offset assignment, but it's not a property that is honored by the solver. It would take some extra work if you want the solver to recognize such fixed objects and place buffers around them.

mmoffitt avatar Jul 12 '24 15:07 mmoffitt

Thank you for your reply. Now I understand the meaning of offset filed. Do you have any suggestions If I want to add the feature I mentioned above?

Gxiandy avatar Jul 16 '24 02:07 Gxiandy

I've just pushed a change that should add solver support for fixed offsets. Would you mind giving it a try?

mmoffitt avatar Jul 16 '24 19:07 mmoffitt

That's great! I‘d like to !

Gxiandy avatar Jul 17 '24 03:07 Gxiandy

Thanks for your work. I've tried this fix in our project and it works. However, we found that for some cases, minimalloc can not found a solution within the required time (which is 30s for 200 buffers), but when we use first-fit method for memory allocation, we will get right solution in very short time. Seems that the partial-allocation problem is not friendly to minimalloc? btw, I suggest that use number of backtrack times to determine whether timeout occurs because it is more stable.

Gxiandy avatar Aug 01 '24 11:08 Gxiandy

There's one more change I ought to make for the "fixed offset" feature to be fully performant -- I'll let you know once it's checked in, might take me a couple days.

mmoffitt avatar Aug 03 '24 21:08 mmoffitt

Just added one more check that should allow for earlier termination -- let me know if this fixes the issue (if not, I can try a few more things).

mmoffitt avatar Aug 11 '24 23:08 mmoffitt