Skip to content

Commit

Permalink
revise program-manager.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
fs-eire committed Oct 12, 2023
1 parent 657da70 commit 08c0f23
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions js/web/lib/wasm/jsep/webgpu/program-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@ export class ProgramManager {

const kernelId = this.backend.currentKernelId!;
const kernelInfo = this.backend.kernels.get(kernelId)!;
const kernelName = `[${kernelInfo[0]}] ${kernelInfo[1]}`;

syncData.buffer.mapAsync(GPUMapMode.READ).then(() => {
const mappedData = new BigUint64Array(syncData.buffer.getMappedRange());
const startTimeU64 = mappedData[0];
const endTimeU64 = mappedData[1];
const [startTimeU64, endTimeU64] = mappedData;
const [kernelType, kernelName] = kernelInfo;

syncData.buffer.unmap();

Expand All @@ -119,8 +118,8 @@ export class ProgramManager {
outputsMetadata: outputTensorViews.map(
value => ({dims: value.dims, dataType: tensorDataTypeEnumToString(value.dataType)})),
kernelId,
kernelType: kernelInfo[0],
kernelName: kernelInfo[1],
kernelType,
kernelName,
startTime,
endTime,
});
Expand All @@ -135,8 +134,8 @@ export class ProgramManager {
outputShapes += `output[${i}]: [${value.dims}] | ${tensorDataTypeEnumToString(value.dataType)}, `;
});
// eslint-disable-next-line no-console
console.log(`[profiling] kernel "${kernelId}|${kernelName}" ${inputShapes}${outputShapes}execution time: ${
endTime - startTime} ns`);
console.log(`[profiling] kernel "${kernelId}|[${kernelType}] ${kernelName}" ${inputShapes}${
outputShapes}execution time: ${endTime - startTime} ns`);
}
});
}
Expand Down

0 comments on commit 08c0f23

Please sign in to comment.