Skip to content

Commit e3c1256

Browse files
authored
Merge pull request #652 from mikepapadim/feature/bc_dealloc_pretty_print
[loging] Enhance deallocation logging to include materialization of action
2 parents 2e838d8 + 38f034d commit e3c1256

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

tornado-runtime/src/main/java/uk/ac/manchester/tornado/runtime/interpreter/DebugInterpreter.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ static void logAllocObject(Object object, TornadoXPUDevice interpreterDevice, lo
4444
appendLogBuilder(verbose, logBuilder);
4545
}
4646

47-
static void logDeallocObject(Object object, TornadoXPUDevice interpreterDevice, StringBuilder logBuilder) {
48-
String verbose = String.format("bc: %s[0x%x] %s on %s", //
49-
InterpreterUtilities.debugHighLightBC("DEALLOC"), //
47+
static void logDeallocObject(Object object, TornadoXPUDevice interpreterDevice, StringBuilder logBuilder, boolean materializeDealloc) {
48+
String verbose = String.format("bc: %s[0x%x] %s [Status: %s] on %s", //
49+
materializeDealloc ? InterpreterUtilities.debugHighLightBC("DEALLOC") : InterpreterUtilities.debugHighLightNonExecBC("DEALLOC"), //
5050
object.hashCode(), //
5151
object, //
52-
InterpreterUtilities.debugDeviceBC(interpreterDevice));
52+
InterpreterUtilities.debugHighLightNonExecBC(materializeDealloc ? "Freed" : "Persisted"), //
53+
InterpreterUtilities.debugDeviceBC(interpreterDevice)); //
5354
appendLogBuilder(verbose, logBuilder);
5455
}
5556

tornado-runtime/src/main/java/uk/ac/manchester/tornado/runtime/interpreter/TornadoVMInterpreter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,13 +498,13 @@ private int executeAlloc(StringBuilder logBuilder, int[] args, long sizeBatch) {
498498
private int executeDeAlloc(StringBuilder tornadoVMBytecodeList, final int objectIndex) {
499499
Object object = objects.get(objectIndex);
500500

501-
if (TornadoOptions.PRINT_BYTECODES && isNotObjectAtomic(object)) {
502-
DebugInterpreter.logDeallocObject(object, interpreterDevice, tornadoVMBytecodeList);
503-
}
504-
505501
final XPUDeviceBufferState objectState = resolveObjectState(objectIndex);
506502
long spaceDeallocated = interpreterDevice.deallocate(objectState);
507503
// Update current device area use
504+
if (TornadoOptions.PRINT_BYTECODES && isNotObjectAtomic(object)) {
505+
boolean materializeDealloc = spaceDeallocated == 0;
506+
DebugInterpreter.logDeallocObject(object, interpreterDevice, tornadoVMBytecodeList, materializeDealloc);
507+
}
508508
graphExecutionContext.setCurrentDeviceMemoryUsage(graphExecutionContext.getCurrentDeviceMemoryUsage() - spaceDeallocated);
509509
return -1;
510510
}

0 commit comments

Comments
 (0)