onnxruntime/onnxruntime
Chester Liu eb2ec66716
Initialize device_id in cuda_call & rocm_call (#20933)
### Description
<!-- Describe your changes. -->

Initialize `device_id` with `-1` in  `cuda_call` and `rocm_call`.

### Motivation and Context

From PyTorch code:
bb2de3b101/c10/cuda/CUDAFunctions.cpp (L217-L324)

If `cudaGetDevice` or `hipGetDevice` failed, an uninitialized `int`
would produce a random number that changes during each run:

```text
[with ERRTYPE = hipError_t; bool THRW = true; std::conditional_t<THRW, void, common::Status> = void] HIP failure 101: invalid device ordinal ; GPU=32741 ; hostname=e6724be2a31a ; file=/onnxruntime_src/onnxruntime/core/providers/rocm/rocm_common.h ; line=66 ; expr=hipGetDeviceProperties(&deviceProp, 0); 
```

Notice the `GPU` value above. Using `-1` would clearly indicate such
failure and avoid confusion.
2024-06-06 11:19:09 +08:00
..
contrib_ops fix integer overflow in Attention (#20921) 2024-06-05 10:19:26 -07:00
core Initialize device_id in cuda_call & rocm_call (#20933) 2024-06-06 11:19:09 +08:00
python [Quant tool] Improve performance of int4 weight quantization (#20935) 2024-06-05 16:48:40 -07:00
test [QNN EP] Update to QNN SDK 2.22 (#20628) 2024-06-05 18:25:23 -07:00
tool/etw
wasm [js/web] optimize module export and deployment (#20165) 2024-05-20 09:51:16 -07:00
__init__.py Bump up version in main from 1.18.0 to 1.19.0 (#20489) 2024-04-29 20:21:41 -07:00
ReformatSource.ps1
ReformatSourcePython.bat
VSCodeCoverage.runsettings