Skip to content

Commit 9aa2ddb

Browse files
authored
Merge pull request #653 from mikepapadim/hotfix/object_repetition_with_shared_buffers
[hotfix] Object repetition with shared buffers on ON_DEVICE bytecodes
2 parents e3c1256 + 184bda9 commit 9aa2ddb

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

tornado-runtime/src/main/java/uk/ac/manchester/tornado/runtime/graph/TornadoVMBytecodeBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void emitAsyncNode(AbstractNode node, int dependencyBC, long offset, long batchS
8989
if (node instanceof AllocateMultipleBuffersNode allocateMultipleBuffersNode) {
9090
bitcodeASM.allocate(allocateMultipleBuffersNode.getValues(), batchSize);
9191
} else if (node instanceof OnDeviceObjectNode onDeviceObjectNode) {
92-
bitcodeASM.onDevice(onDeviceObjectNode.getIndex(), dependencyBC, offset, batchSize);
92+
bitcodeASM.onDevice(onDeviceObjectNode.getValue().getIndex(), dependencyBC, offset, batchSize);
9393
} else if (node instanceof CopyInNode copyInNode) {
9494
bitcodeASM.transferToDeviceOnce(copyInNode.getValue().getIndex(), dependencyBC, offset, batchSize);
9595
} else if (node instanceof AllocateNode allocateNode) {

tornado-runtime/src/main/java/uk/ac/manchester/tornado/runtime/graph/nodes/OnDeviceObjectNode.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* This code is distributed in the hope that it will be useful, but WITHOUT
1414
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1616
* version 2 for more details (a copy is included in the LICENSE file that
1717
* accompanied this code).
1818
*
@@ -28,23 +28,27 @@
2828
import java.util.List;
2929

3030
public class OnDeviceObjectNode extends ContextOpNode {
31+
private ObjectNode value;
32+
3133
public OnDeviceObjectNode(ContextNode context) {
3234
super(context);
3335
}
3436

35-
private ObjectNode value;
37+
public ObjectNode getValue() {
38+
return value;
39+
}
3640

3741
public void setValue(ObjectNode object) {
3842
value = object;
3943
}
4044

41-
public ObjectNode getValue() {
42-
return value;
43-
}
44-
4545
@Override
4646
public String toString() {
47-
return String.format("[%d]: on-device object %d", id, value.getIndex());
47+
if (value == null) {
48+
return String.format("[%d]: on-device object (value not set)", id);
49+
} else {
50+
return String.format("[%d]: on-device object %d", id, value.getIndex());
51+
}
4852
}
4953

5054
@Override

0 commit comments

Comments
 (0)