Update(DeviceProxy): Dynamically Determine Memory Allocation Size & Remove Compile-Time size Calculations (#48)

* Update(DeviceProxy): Dynamically Determine Memory Allocation Size & Remove Compile-Time size Calculations

- Modified the Device proxy class to determine memory allocation size at runtime.
- Updated all classes that include the Device proxy to use dynamic memory allocation.
- Removed compile-time memory size calculations.
- Ensured the allocated number of backend queue data structures matches the number of RO device contexts.
Tá an tiomantas seo le fáil i:
Avinash Kethineedi
2025-02-24 15:11:46 -06:00
tiomanta ag GitHub
tuismitheoir 487e5b7d0f
tiomantas eb5a38e806
D'athraigh 23 comhad le 302 breiseanna agus 118 scriosta
+9 -1
Féach ar an gComhad
@@ -101,10 +101,18 @@ class NotifierProxy {
using ProxyT = DeviceProxy<ALLOCATOR, Notifier<scope>>;
public:
NotifierProxy() {
NotifierProxy(size_t num_elems = 1) : proxy_{num_elems} {
new (proxy_.get()) Notifier<scope>();
}
NotifierProxy(const NotifierProxy& other) = delete;
NotifierProxy& operator=(const NotifierProxy& other) = delete;
NotifierProxy(NotifierProxy&& other) = default;
NotifierProxy& operator=(NotifierProxy&& other) = default;
~NotifierProxy() {
proxy_.get()->~Notifier<scope>();
}
+12 -2
Féach ar an gComhad
@@ -160,13 +160,23 @@ class SlabHeap {
template <typename ALLOCATOR>
class SlabHeapProxy {
using ProxyT = DeviceProxy<ALLOCATOR, SlabHeap, 1>;
using ProxyT = DeviceProxy<ALLOCATOR, SlabHeap>;
public:
/*
* Placement new the memory which is allocated by proxy_
*/
SlabHeapProxy() { new (proxy_.get()) SlabHeap(); }
SlabHeapProxy(size_t num_elems = 1) : proxy_{num_elems} {
new (proxy_.get()) SlabHeap();
}
SlabHeapProxy(const SlabHeapProxy& other) = delete;
SlabHeapProxy& operator=(const SlabHeapProxy& other) = delete;
SlabHeapProxy(SlabHeapProxy&& other) = default;
SlabHeapProxy& operator=(SlabHeapProxy&& other) = default;
/*
* Since placement new is called in the constructor, then