Skip to content

Commit

Permalink
compare the content of WEBGPU_BUFFER, not the address (#21967)
Browse files Browse the repository at this point in the history
On linux (not sure about windows) WEBGPU_BUFFER is defined in multiple
object files and comparing the address is not sufficient - use strcmp.
onnxruntime uses strcmp for the most but there are some other places
that compare against address which might make trouble if passed acrross
object file boundary.
  • Loading branch information
guschmue authored Sep 3, 2024
1 parent 33726b1 commit 50ea9eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions onnxruntime/core/providers/webgpu/webgpu_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Status WebGpuContext::Run(const ComputeContext& context, const ProgramBase& prog
return tensor != nullptr &&
tensor->Location().mem_type == OrtMemType::OrtMemTypeDefault &&
tensor->Location().device.Type() == OrtDevice::GPU &&
tensor->Location().name == WEBGPU_BUFFER;
!strcmp(tensor->Location().name, WEBGPU_BUFFER);
}),
"All inputs must be tensors on WebGPU buffers.");

Expand All @@ -149,7 +149,7 @@ Status WebGpuContext::Run(const ComputeContext& context, const ProgramBase& prog
return tensor != nullptr &&
tensor->Location().mem_type == OrtMemType::OrtMemTypeDefault &&
tensor->Location().device.Type() == OrtDevice::GPU &&
tensor->Location().name == WEBGPU_BUFFER;
!strcmp(tensor->Location().name, WEBGPU_BUFFER);
}),
"All outputs must be tensors on WebGPU buffers.");
#endif
Expand Down

0 comments on commit 50ea9eb

Please sign in to comment.