onnxruntime
f0da3c4e - [WebGPU] Enable Cast to int64 by default (#28804)

Commit
131 days ago
[WebGPU] Enable Cast to int64 by default (#28804) ### Description Support casting to int64 from float32 via IEEE-754 bit decomposition. - Introduce a new `float_to_int64` helper that emits the truncated-toward-zero value in full int64 range. - `to_` type now always allows int64, regardless of `enable_int64`; casting *from* int64 stays gated by `enable_int64`. - Adds `cast_op_test.cc` coverage for the newly introduced conversions. ### Motivation and Context While running the mask-generation vision encoder (`Xenova/sam-vit-base`) on the WebGPU EP via Transformers.js, float32-to-int64 cast nodes fall back to the CPU provider under the default session configuration, because casting to int64 was previously gated behind `enable_int64` flag, introducing host memcpy and synchronization overhead. Making cast-to-int64 correct across the full int64 range lets it run on the WebGPU EP by default, keeping these nodes on-device and eliminating the stalls. ### Performance Impact Measured on the `vision_encoder.onnx` of `Xenova/sam-vit-base` (mask-generation, SAM ViT-base vision encoder) on the WebGPU EP. | Platform | Latency reduction | Speedup | |------------------|------------------:|--------:| | Intel Wildcat Lake | −22.8% | 1.30× | | Intel Panther Lake | −17.1% | 1.21× | This change yields a 1.2–1.3× speedup on the SAM ViT-base vision encoder under default configuration.
Author
Parents
Loading