libsupport_zynq/ram: split allocator for each core. #47

Closed
pca006132 wants to merge 2 commits from pca006132:separate-alloc into master
Contributor

Implementation for #46.

Allocation request would use the allocator for that core. Deallocation would check the pointer range to determine the correct memory allocator responsible for deallocating the memory, as it is possible to allocate a buffer in core1, send it to core0 and deallocate it in core0 for example.

The separate allocator feature is gated behind the feature alloc_core, so modules like experiments or szl in artiq-zynq which does not need this feature would not be affected.

Tested using artiq-zynq, did not break anything currently after running several mandelbrot and complex return type examples.

Implementation for #46. Allocation request would use the allocator for that core. Deallocation would check the pointer range to determine the correct memory allocator responsible for deallocating the memory, as it is possible to allocate a buffer in core1, send it to core0 and deallocate it in core0 for example. The separate allocator feature is gated behind the feature `alloc_core`, so modules like experiments or szl in artiq-zynq which does not need this feature would not be affected. Tested using artiq-zynq, did not break anything currently after running several mandelbrot and complex return type examples.
astro reviewed 2020-07-18 22:55:22 +08:00
@ -22,0 +33,4 @@
let end0 = &__heap0_end as *const usize as *const u8;
let start1 = &__heap1_start as *const usize as *const u8;
let end1 = &__heap1_end as *const usize as *const u8;
let const_ptr = ptr as *const u8;
Contributor

let ptr = ptr as *const u8;

`let ptr = ptr as *const u8;`
Author
Contributor

I don't think this works, as this does not work for

pub const unsafe fn new_unchecked(ptr: *mut T) -> NonNull<T>

which the pointer has to be mutable here.

I don't think this works, as this does not work for ```rust pub const unsafe fn new_unchecked(ptr: *mut T) -> NonNull<T> ``` which the pointer has to be mutable here.
Author
Contributor

I would post a new PR with solution (Hack) for M-Labs/artiq-zynq#32

I would post a new PR with solution (Hack) for https://git.m-labs.hk/M-Labs/artiq-zynq/issues/32
pca006132 closed this pull request 2020-07-20 11:07:45 +08:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/zynq-rs#47
No description provided.