Fix cuda 12.9 windows build (#25317)
### Description
Fix Windows build with MSVC 17.14.7 and cuda 12.9.1.
The build error was like:
`CUDACOMPILE : nvcc error : 'cudafe++' died with status 0xC0000005
(ACCESS_VIOLATION)`
The cause is unknown (maybe cudafe bug). The code change resolved the
issue. I've verified it in two machines.