This repository was archived by the owner on Aug 5, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -112,9 +112,21 @@ class MKLDNNMemoryDescriptorBase : public PrvMemDescr
112112
113113 void allocate () {
114114 if (_prv_memory == NULL ) {
115+ #ifdef USE_MLSL
116+ if (mn::is_multinode ()) {
117+ auto mlsl_free = [](char * p) { mn::free ((void *)p); };
118+ _mlsl_memory.reset (
119+ (char *)mn::alloc (_prv_memory_pd->get_size (), 64 ), mlsl_free);
120+ _prv_memory = shared_ptr<memory>(
121+ new memory (*_prv_memory_pd, (void *)_mlsl_memory.get ()));
122+ } else {
123+ #endif
115124 _prv_memory = shared_ptr<memory>(new memory (*_prv_memory_pd));
116- _internal_ptr = (Dtype *)(_prv_memory->get_data_handle ());
117- // TODO: may need initialize memory by 0
125+ #ifdef USE_MLSL
126+ }
127+ #endif
128+ _internal_ptr = (Dtype *)(_prv_memory->get_data_handle ());
129+ // TODO: may need initialize memory by 0
118130 }
119131 }
120132 void set_prv_memory_pd (shared_ptr<memory::primitive_desc> memory_pd) {
@@ -156,6 +168,9 @@ class MKLDNNMemoryDescriptorBase : public PrvMemDescr
156168
157169 MKLDNNLayer<Dtype>* _mkldnn_layer;
158170 Blob<Dtype>* _blob;
171+ #ifdef USE_MLSL
172+ shared_ptr<char > _mlsl_memory;
173+ #endif
159174};
160175
161176template <typename Dtype, bool is_diff>
You can’t perform that action at this time.
0 commit comments