Commit e2f9aa5
authored
[OpenMP][MI-300][Runtime] Handling crash with
Fix a crash in `omp_get_default_device()` when
`OMP_TARGET_OFFLOAD=DISABLED` is set together with a non-zero
`OMP_DEFAULT_DEVICE` value.
When users set both:
`OMP_TARGET_OFFLOAD=DISABLED` (to disable GPU offloading)
`OMP_DEFAULT_DEVICE=N` (where N > 0)
The application would crash with:
`omptarget fatal error 2: "invalid value" device number 'N' out of
range, only 0 devices available`
Reason: This occurs because `omp_get_default_device()` returned the
value from `OMP_DEFAULT_DEVICE` (or from `omp_set_default_device()`)
even when offloading was disabled, causing program to execute the code
associated with the non-existent devices.
The solution ensures that when offloading is disabled, all
device-related functions return values consistent with host-only
execution by returning the initial device value.
Testing: testing with the smoke test with PR
[1787](ROCm/aomp#1787)OMP_TARGET_OFFLOAD=DISABLED and invoking omp_get_default_device() (#809)1 parent 69e3fa1 commit e2f9aa5
1 file changed
+11
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1213 | 1213 | | |
1214 | 1214 | | |
1215 | 1215 | | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | 1216 | | |
1225 | 1217 | | |
1226 | 1218 | | |
| |||
1267 | 1259 | | |
1268 | 1260 | | |
1269 | 1261 | | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
1270 | 1273 | | |
1271 | 1274 | | |
1272 | 1275 | | |
| |||
0 commit comments