Skip to content

[webgpu] Simplify o2i_output implementation#23351

Merged
fs-eire merged 1 commit intomicrosoft:mainfrom
daijh:o2i_output
Jan 14, 2025
Merged

[webgpu] Simplify o2i_output implementation#23351
fs-eire merged 1 commit intomicrosoft:mainfrom
daijh:o2i_output

Conversation

@daijh
Copy link
Contributor

@daijh daijh commented Jan 14, 2025

Description

This change simplifies the o2i_output implementation by reducing unnecessary intermediate variables, with no change in functionality.

Motivation and Context

As above.

This change simplifies the o2i_output implementation by reducing
unnecessary intermediate variables.

Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com>
@daijh
Copy link
Contributor Author

daijh commented Jan 14, 2025

Before:

fn o2i_output(offset : u32)->vec3<u32> {
  var indices: vec3<u32>;
  var current = offset;
  let dim0 = current / uniforms.output_stride[0];
  let rest0 = current % uniforms.output_stride[0];
  indices[0] = dim0;
  current = rest0;
  let dim1 = current / uniforms.output_stride[1];
  let rest1 = current % uniforms.output_stride[1];
  indices[1] = dim1;
  current = rest1;
  indices[2] = current;
  return indices;
}

After:

fn o2i_output(offset : u32)->vec3<u32> {
  var indices: vec3<u32>;
  var current = offset;
  indices[0] = current / uniforms.output_stride[0];
  current = current % uniforms.output_stride[0];
  indices[1] = current / uniforms.output_stride[1];
  current = current % uniforms.output_stride[1];
  indices[2] = current;
  return indices;
}

@fs-eire
Copy link
Contributor

fs-eire commented Jan 14, 2025

/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows CPU CI Pipeline,Windows GPU CUDA CI Pipeline,Windows GPU DML CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Jan 14, 2025

/azp run Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline,Linux QNN CI Pipeline,MacOS CI Pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,onnxruntime-binary-size-checks-ci-pipeline,Big Models,Linux Android Emulator QNN CI Pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Jan 14, 2025

/azp run Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline,CoreML CI Pipeline,Linux DNNL CI Pipeline,Linux MIGraphX CI Pipeline,Linux ROCm CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 7 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 8 pipeline(s).

@fs-eire
Copy link
Contributor

fs-eire commented Jan 14, 2025

/azp run Windows GPU WebGPU CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 10 pipeline(s).

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@fs-eire
Copy link
Contributor

fs-eire commented Jan 14, 2025

/azp run Win_TRT_Minimal_CUDA_Test_CI

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@guschmue guschmue added the ep:WebGPU ort-web webgpu provider label Jan 14, 2025
@fs-eire fs-eire merged commit 4a0269a into microsoft:main Jan 14, 2025
92 checks passed
guschmue pushed a commit that referenced this pull request Mar 6, 2025
### Description
This change simplifies the o2i_output implementation by reducing
unnecessary intermediate variables, with no change in functionality.

### Motivation and Context
As above.

Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com>
@daijh daijh deleted the o2i_output branch March 12, 2025 07:55
ashrit-ms pushed a commit that referenced this pull request Mar 17, 2025
### Description
This change simplifies the o2i_output implementation by reducing
unnecessary intermediate variables, with no change in functionality.

### Motivation and Context
As above.

Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ep:WebGPU ort-web webgpu provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants