onnxruntime
eb7a1bf2 - [WebGPU EP] Reduce forward declaration boilerplate in kernel registration (#27977)

Commit
91 days ago
[WebGPU EP] Reduce forward declaration boilerplate in kernel registration (#27977) ### Description <!-- Describe your changes. --> Update WebGPU EP kernel registration to remove redundant forward declarations. E.g., change from this: ```c++ class ONNX_OPERATOR_KERNEL_CLASS_NAME(kWebGpuExecutionProvider, kMSDomain, 1, Attention); static const BuildKernelCreateInfoFn function_table[] = { ... BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kWebGpuExecutionProvider, kMSDomain, 1, Attention)>, ``` to this: ```c++ static const BuildKernelCreateInfoFn function_table[] = { ... BuildKernelCreateInfo<class ONNX_OPERATOR_KERNEL_CLASS_NAME(kWebGpuExecutionProvider, kMSDomain, 1, Attention)>, ``` One subtlety is that the function table needs to be moved outside of the function now, since function-local (block scope) forward declarations would introduce names with no linkage. Those names should have external linkage. We already do something similar here: https://github.com/microsoft/onnxruntime/blob/aaa49440491a88f812ba79355b18457c8fa9ed7c/onnxruntime/test/autoep/library/example_plugin_ep_kernel_registry/ep_kernel_registration.cc#L12 ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Reduce boilerplate.
Author
Parents
Loading