Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jjfumero committed Feb 28, 2022
2 parents 479861c + 2ca69d7 commit 4f34abc
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@

public class LevelZeroUtils {

public static final boolean DEBUG = Boolean.parseBoolean(System.getProperties().getProperty("tornado.debug", "False"));
public static final String YELLOW = "\u001B[33m";
public static final String RESET = "\u001B[0m";


/**
* Utility for controlling error from a method invoked using the JNI Level Zero
* library.
*
*
* @param method
* Method called.
* @param result
Expand All @@ -79,7 +84,7 @@ public static void errorLog(String method, int result) {

/**
* Utility for creating a Level Zero Context.
*
*
* @param driver
* {@link LevelZeroDriver}
* @return {@link LevelZeroContext}
Expand Down Expand Up @@ -110,7 +115,7 @@ public static LevelZeroContext zeInitContext(LevelZeroDriver driver) {

/**
* Utility for instantiating a {@link LevelZeroDevice}.
*
*
* @param context
* {@link LevelZeroContext}
* @param driver
Expand Down Expand Up @@ -187,7 +192,7 @@ public static LevelZeroCommandQueue createCommandQueue(LevelZeroDevice device, L

/**
* Utility for creating a Level Zero Command List.
*
*
* @param device
* {@link LevelZeroDevice}
* @param context
Expand Down Expand Up @@ -244,7 +249,7 @@ public static LevelZeroKernel compileSPIRVKernel(LevelZeroDevice device, LevelZe

/**
* Dispatch the LookUpBufferKernel.
*
*
* @param commandList
* {@link LevelZeroCommandList}
* @param commandQueue
Expand All @@ -256,7 +261,7 @@ public static LevelZeroKernel compileSPIRVKernel(LevelZeroDevice device, LevelZe
* @param output
* Long array with the results
* @param bufferSize
*
*
* @return Long value with a valid address for the device (base address).
*/
public static long dispatchLookUpBuffer(LevelZeroCommandList commandList, LevelZeroCommandQueue commandQueue, LevelZeroKernel levelZeroKernel, LevelZeroByteBuffer deviceBuffer, long[] output,
Expand Down Expand Up @@ -320,7 +325,9 @@ public static long dispatchLookUpBuffer(LevelZeroCommandList commandList, LevelZ

long baseAddress = allocate.getLong(0);
output[0] = baseAddress;
System.out.println("Base Address: " + Long.toUnsignedString(baseAddress));
if (DEBUG) {
System.out.printf(YELLOW + "[SPIRV-V-Runtime] Base Address " + baseAddress + RESET + "%%n");
}
commandList.zeCommandListReset(commandList.getCommandListHandlerPtr());
errorLog("zeCommandListReset", result);
return baseAddress;
Expand Down

0 comments on commit 4f34abc

Please sign in to comment.