CHAI icon indicating copy to clipboard operation
CHAI copied to clipboard

Efficient realloc: only copy data in touched spaces

Open davidbeckingsale opened this issue 7 years ago • 3 comments

davidbeckingsale avatar Mar 27 '18 22:03 davidbeckingsale

Thanks @robinson96, I'll write up some more test cases and check that this all works.

davidbeckingsale avatar Mar 28 '18 20:03 davidbeckingsale

One other concern - by choosing not to do a realloc on the CPU side of things, you're forcing a copy to always happen, while most realloc implementations will avoid a copy if the realloc ends up with the same address (which happens pretty often, in my experience). Does Umpire have a realloc API? Should it?

robinson96 avatar Mar 29 '18 15:03 robinson96

It does, but that means we can't avoid the unnecessary copies on the CPU side - you call realloc and the semantics of realloc are what you will get. If you only want to avoid a device-side copy then that would be fine.

davidbeckingsale avatar Mar 29 '18 15:03 davidbeckingsale