Skip to content

Commit

Permalink
add verbose log for buffer upload/download
Browse files Browse the repository at this point in the history
  • Loading branch information
fs-eire committed Sep 13, 2022
1 parent 179712b commit 7fca0ea
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions js/web/lib/onnxjs/backends/webgpu/gpu-data-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Licensed under the MIT License.

import {Guid} from 'guid-typescript';

import {Logger} from '../../instrument';

import {sizeof, Tensor} from '../../tensor';
import {ShapeUtil} from '../../util';
import {GpuData, GpuDataId, GpuDataType} from './types';
Expand Down Expand Up @@ -64,6 +67,8 @@ class GpuDataManagerImpl implements GpuDataManager {
throw new Error('we only support default GPU data type now');
}

Logger.verbose('GpuData', `Uploading data to GPU: {${data.length}}`);

const srcArrayBuffer = data.buffer;
const srcOffset = data.byteOffset;
const srcLength = data.byteLength;
Expand Down Expand Up @@ -139,6 +144,8 @@ class GpuDataManagerImpl implements GpuDataManager {
throw new Error('data does not exist');
}

Logger.verbose('GpuData', `Downloading data from GPU: {${id}}`);

const commandEncoder = this.device.createCommandEncoder();
const gpuReadBuffer =
// eslint-disable-next-line no-bitwise
Expand Down

0 comments on commit 7fca0ea

Please sign in to comment.