You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemds.apache.org by GitBox <gi...@apache.org> on 2021/01/18 20:27:57 UTC

[GitHub] [systemds] philipportner commented on a change in pull request #1147: Unified Memory Manager design proposal

philipportner commented on a change in pull request #1147:
URL: https://github.com/apache/systemds/pull/1147#discussion_r559781921



##########
File path: scripts/staging/unified-memory-manager/umm.md
##########
@@ -0,0 +1,144 @@
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% end comment %}
+-->
+
+# Unified Memory Manager - Design Document
+
+| **Author(s)** | Philipp Ortner |
+:-------------- |:----------------------------------------------------|
+
+## Description
+This document describes the initial design of an Unified Memory Manager proposed
+for SystemDS.
+
+## Design
+The Unified Memory Manager, henceforth UMM, will act as a manager for heap memory
+provided by the JVM.
+
+The UMM has a certain (% of JVM heap) amount of memory which it can distribute for operands
+and a buffer pool.
+
+Operands are the compiled programs variables which extends the base class 
+`Data`, e.g., `MatrixObject` and `StringObject`.
+The buffer pool manages
+in memory representation of dirty objects that don't exist on the HDFS or 
+other persistent memory. This is currently done by the `LazyWriteBuffer`. Intermediates
+could be represented in this buffer.
+
+These two memory areas each will have a min and max amount of memory it can
+occupy, meaning that the boundary for the areas can shift dynamically depending
+on the current load.
+
+||min|max|
+| ------------- |:-------------:| -----:|
+| operations  | 50% | 70% |
+| buffer pool | 15% | 30% |
+
+The UMM will utilise the existing `CacheBlock` structure to manage the buffer
+pool area while it will use the new `OperandBlock (?)` structure to keep track of
+operations.
+
+### UMM Java Class
+For starters, we want to keep the API rather simple.
+
+```java
+/**
+ * Pins the input block into main memory.
+ * The provided block needs to fit into UMM boundaries.
+ */
+void pin(String, Block);
+
+/**
+ * Unpins the input block from main memory.
+ */
+void unpin(String);
+
+/**
+ * Loads the block into memory and pins it, if not evicted just pins it(?)
+ * The requested block needs to fit into UMM boundaries.
+ */
+Block serve(String);
+
+/**
+ * Reserves an specified amount in one of the two memory areas.
+ * The requested block needs to fit into UMM boundaries.
+ */
+Block reserve(Size, MemoryArea);

Review comment:
       Yes, I thought one may want the handle as soon as the memory is reserved.  If that's not the case I'll make it `void reserve(Size)`.

##########
File path: scripts/staging/unified-memory-manager/umm.md
##########
@@ -0,0 +1,144 @@
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% end comment %}
+-->
+
+# Unified Memory Manager - Design Document
+
+| **Author(s)** | Philipp Ortner |
+:-------------- |:----------------------------------------------------|
+
+## Description
+This document describes the initial design of an Unified Memory Manager proposed
+for SystemDS.
+
+## Design
+The Unified Memory Manager, henceforth UMM, will act as a manager for heap memory
+provided by the JVM.
+
+The UMM has a certain (% of JVM heap) amount of memory which it can distribute for operands
+and a buffer pool.
+
+Operands are the compiled programs variables which extends the base class 
+`Data`, e.g., `MatrixObject` and `StringObject`.
+The buffer pool manages
+in memory representation of dirty objects that don't exist on the HDFS or 
+other persistent memory. This is currently done by the `LazyWriteBuffer`. Intermediates
+could be represented in this buffer.
+
+These two memory areas each will have a min and max amount of memory it can
+occupy, meaning that the boundary for the areas can shift dynamically depending
+on the current load.
+
+||min|max|
+| ------------- |:-------------:| -----:|
+| operations  | 50% | 70% |
+| buffer pool | 15% | 30% |
+
+The UMM will utilise the existing `CacheBlock` structure to manage the buffer
+pool area while it will use the new `OperandBlock (?)` structure to keep track of
+operations.
+
+### UMM Java Class
+For starters, we want to keep the API rather simple.
+
+```java
+/**
+ * Pins the input block into main memory.
+ * The provided block needs to fit into UMM boundaries.
+ */
+void pin(String, Block);
+
+/**
+ * Unpins the input block from main memory.
+ */
+void unpin(String);

Review comment:
       Not quite sure how I would merge that with `resize_reserved`.
   `void unpin(String, Size)` and move the block from operation memory to the buffer pool and drop/resize if already in buffer pool?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org