Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js/webgpu] Enable GroupedConvVectorize path #19791

Merged
merged 6 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address Yulong's comments
  • Loading branch information
gyagp committed Mar 11, 2024
commit 7e3ad3a64d8f888d951fa3b5f27cdf6bc0cf5da7
4 changes: 2 additions & 2 deletions js/web/lib/wasm/jsep/backend-webgpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ const getProgramInfoUniqueKey =
};

class AdapterInfoImpl implements AdapterInfo {
readonly architecture: string;
readonly vendor: string;
readonly architecture?: string;
readonly vendor?: string;

constructor(adapterInfo: GPUAdapterInfo) {
if (adapterInfo) {
Expand Down
5 changes: 2 additions & 3 deletions js/web/lib/wasm/jsep/webgpu/ops/conv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,10 @@ const conv2d = (context: ComputeContext, inputs: readonly TensorView[], attribut
const isChannelsLast = attributes.format === 'NHWC';
if (attributes.group !== 1) {
// One CI with NVIDIA GPU (ampere architecutre) fails with below 2 cases, but we couldn't repro them with any other
// GPUs, including NVIDIA ones.
// GPUs, including NVIDIA ones. So just disable vectorize on NVIDIA ampere to ensure always correct outputs.
// [webgpu]Conv - conv - vectorize group - B
// [webgpu]Conv - conv - vectorize group - D
// Disable vectorize on NVIDIA ampere to make bots happy.
const enableGroupedConvVectorize = context.adapterInfo.isArchitecture('ampere') ? false : true;
const enableGroupedConvVectorize = !context.adapterInfo.isArchitecture('ampere');
if (enableGroupedConvVectorize && isChannelsLast && inputs[1].dims[0] === attributes.group &&
inputs[1].dims[1] === 1 && attributes.dilations[0] === 1 && attributes.dilations[1] === 1) {
const outputShape = calculateOutputShape(
Expand Down
3 changes: 0 additions & 3 deletions js/web/lib/wasm/jsep/webgpu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ export type GpuDataId = number;
export type GpuArchitecture = 'ampere';
export type GpuVendor = 'amd'|'intel'|'nvidia';
export interface AdapterInfo {
readonly architecture: string;
readonly vendor: string;

isArchitecture: (architecture: GpuArchitecture) => boolean;
isVendor: (vendor: GpuVendor) => boolean;
}
Expand Down