@@ -352,14 +352,6 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetNativeHandle(
352
352
return result;
353
353
}
354
354
355
- try {
356
- // convert platform handle to loader handle
357
- *phNativePlatform = reinterpret_cast <ur_native_handle_t >(
358
- ur_native_factory.getInstance (*phNativePlatform, dditable));
359
- } catch (std::bad_alloc &) {
360
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
361
- }
362
-
363
355
return result;
364
356
}
365
357
@@ -718,14 +710,6 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetNativeHandle(
718
710
return result;
719
711
}
720
712
721
- try {
722
- // convert platform handle to loader handle
723
- *phNativeDevice = reinterpret_cast <ur_native_handle_t >(
724
- ur_native_factory.getInstance (*phNativeDevice, dditable));
725
- } catch (std::bad_alloc &) {
726
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
727
- }
728
-
729
713
return result;
730
714
}
731
715
@@ -744,17 +728,13 @@ __urdlllocal ur_result_t UR_APICALL urDeviceCreateWithNativeHandle(
744
728
745
729
// extract platform's function pointer table
746
730
auto dditable =
747
- reinterpret_cast <ur_native_object_t *>(hNativeDevice )->dditable ;
731
+ reinterpret_cast <ur_platform_object_t *>(hPlatform )->dditable ;
748
732
auto pfnCreateWithNativeHandle =
749
733
dditable->ur .Device .pfnCreateWithNativeHandle ;
750
734
if (nullptr == pfnCreateWithNativeHandle) {
751
735
return UR_RESULT_ERROR_UNINITIALIZED;
752
736
}
753
737
754
- // convert loader handle to platform handle
755
- hNativeDevice =
756
- reinterpret_cast <ur_native_object_t *>(hNativeDevice)->handle ;
757
-
758
738
// convert loader handle to platform handle
759
739
hPlatform = reinterpret_cast <ur_platform_object_t *>(hPlatform)->handle ;
760
740
@@ -994,14 +974,6 @@ __urdlllocal ur_result_t UR_APICALL urContextGetNativeHandle(
994
974
return result;
995
975
}
996
976
997
- try {
998
- // convert platform handle to loader handle
999
- *phNativeContext = reinterpret_cast <ur_native_handle_t >(
1000
- ur_native_factory.getInstance (*phNativeContext, dditable));
1001
- } catch (std::bad_alloc &) {
1002
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
1003
- }
1004
-
1005
977
return result;
1006
978
}
1007
979
@@ -1022,17 +994,13 @@ __urdlllocal ur_result_t UR_APICALL urContextCreateWithNativeHandle(
1022
994
1023
995
// extract platform's function pointer table
1024
996
auto dditable =
1025
- reinterpret_cast <ur_native_object_t *>(hNativeContext )->dditable ;
997
+ reinterpret_cast <ur_device_object_t *>(*phDevices )->dditable ;
1026
998
auto pfnCreateWithNativeHandle =
1027
999
dditable->ur .Context .pfnCreateWithNativeHandle ;
1028
1000
if (nullptr == pfnCreateWithNativeHandle) {
1029
1001
return UR_RESULT_ERROR_UNINITIALIZED;
1030
1002
}
1031
1003
1032
- // convert loader handle to platform handle
1033
- hNativeContext =
1034
- reinterpret_cast <ur_native_object_t *>(hNativeContext)->handle ;
1035
-
1036
1004
// convert loader handles to platform handles
1037
1005
auto phDevicesLocal = std::vector<ur_device_handle_t >(numDevices);
1038
1006
for (size_t i = 0 ; i < numDevices; ++i) {
@@ -1285,14 +1253,6 @@ __urdlllocal ur_result_t UR_APICALL urMemGetNativeHandle(
1285
1253
return result;
1286
1254
}
1287
1255
1288
- try {
1289
- // convert platform handle to loader handle
1290
- *phNativeMem = reinterpret_cast <ur_native_handle_t >(
1291
- ur_native_factory.getInstance (*phNativeMem, dditable));
1292
- } catch (std::bad_alloc &) {
1293
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
1294
- }
1295
-
1296
1256
return result;
1297
1257
}
1298
1258
@@ -1310,17 +1270,13 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle(
1310
1270
ur_result_t result = UR_RESULT_SUCCESS;
1311
1271
1312
1272
// extract platform's function pointer table
1313
- auto dditable =
1314
- reinterpret_cast <ur_native_object_t *>(hNativeMem)->dditable ;
1273
+ auto dditable = reinterpret_cast <ur_context_object_t *>(hContext)->dditable ;
1315
1274
auto pfnBufferCreateWithNativeHandle =
1316
1275
dditable->ur .Mem .pfnBufferCreateWithNativeHandle ;
1317
1276
if (nullptr == pfnBufferCreateWithNativeHandle) {
1318
1277
return UR_RESULT_ERROR_UNINITIALIZED;
1319
1278
}
1320
1279
1321
- // convert loader handle to platform handle
1322
- hNativeMem = reinterpret_cast <ur_native_object_t *>(hNativeMem)->handle ;
1323
-
1324
1280
// convert loader handle to platform handle
1325
1281
hContext = reinterpret_cast <ur_context_object_t *>(hContext)->handle ;
1326
1282
@@ -1360,17 +1316,13 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreateWithNativeHandle(
1360
1316
ur_result_t result = UR_RESULT_SUCCESS;
1361
1317
1362
1318
// extract platform's function pointer table
1363
- auto dditable =
1364
- reinterpret_cast <ur_native_object_t *>(hNativeMem)->dditable ;
1319
+ auto dditable = reinterpret_cast <ur_context_object_t *>(hContext)->dditable ;
1365
1320
auto pfnImageCreateWithNativeHandle =
1366
1321
dditable->ur .Mem .pfnImageCreateWithNativeHandle ;
1367
1322
if (nullptr == pfnImageCreateWithNativeHandle) {
1368
1323
return UR_RESULT_ERROR_UNINITIALIZED;
1369
1324
}
1370
1325
1371
- // convert loader handle to platform handle
1372
- hNativeMem = reinterpret_cast <ur_native_object_t *>(hNativeMem)->handle ;
1373
-
1374
1326
// convert loader handle to platform handle
1375
1327
hContext = reinterpret_cast <ur_context_object_t *>(hContext)->handle ;
1376
1328
@@ -1672,14 +1624,6 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetNativeHandle(
1672
1624
return result;
1673
1625
}
1674
1626
1675
- try {
1676
- // convert platform handle to loader handle
1677
- *phNativeSampler = reinterpret_cast <ur_native_handle_t >(
1678
- ur_native_factory.getInstance (*phNativeSampler, dditable));
1679
- } catch (std::bad_alloc &) {
1680
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
1681
- }
1682
-
1683
1627
return result;
1684
1628
}
1685
1629
@@ -1697,18 +1641,13 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreateWithNativeHandle(
1697
1641
ur_result_t result = UR_RESULT_SUCCESS;
1698
1642
1699
1643
// extract platform's function pointer table
1700
- auto dditable =
1701
- reinterpret_cast <ur_native_object_t *>(hNativeSampler)->dditable ;
1644
+ auto dditable = reinterpret_cast <ur_context_object_t *>(hContext)->dditable ;
1702
1645
auto pfnCreateWithNativeHandle =
1703
1646
dditable->ur .Sampler .pfnCreateWithNativeHandle ;
1704
1647
if (nullptr == pfnCreateWithNativeHandle) {
1705
1648
return UR_RESULT_ERROR_UNINITIALIZED;
1706
1649
}
1707
1650
1708
- // convert loader handle to platform handle
1709
- hNativeSampler =
1710
- reinterpret_cast <ur_native_object_t *>(hNativeSampler)->handle ;
1711
-
1712
1651
// convert loader handle to platform handle
1713
1652
hContext = reinterpret_cast <ur_context_object_t *>(hContext)->handle ;
1714
1653
@@ -2871,14 +2810,6 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetNativeHandle(
2871
2810
return result;
2872
2811
}
2873
2812
2874
- try {
2875
- // convert platform handle to loader handle
2876
- *phNativeProgram = reinterpret_cast <ur_native_handle_t >(
2877
- ur_native_factory.getInstance (*phNativeProgram, dditable));
2878
- } catch (std::bad_alloc &) {
2879
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
2880
- }
2881
-
2882
2813
return result;
2883
2814
}
2884
2815
@@ -2896,18 +2827,13 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle(
2896
2827
ur_result_t result = UR_RESULT_SUCCESS;
2897
2828
2898
2829
// extract platform's function pointer table
2899
- auto dditable =
2900
- reinterpret_cast <ur_native_object_t *>(hNativeProgram)->dditable ;
2830
+ auto dditable = reinterpret_cast <ur_context_object_t *>(hContext)->dditable ;
2901
2831
auto pfnCreateWithNativeHandle =
2902
2832
dditable->ur .Program .pfnCreateWithNativeHandle ;
2903
2833
if (nullptr == pfnCreateWithNativeHandle) {
2904
2834
return UR_RESULT_ERROR_UNINITIALIZED;
2905
2835
}
2906
2836
2907
- // convert loader handle to platform handle
2908
- hNativeProgram =
2909
- reinterpret_cast <ur_native_object_t *>(hNativeProgram)->handle ;
2910
-
2911
2837
// convert loader handle to platform handle
2912
2838
hContext = reinterpret_cast <ur_context_object_t *>(hContext)->handle ;
2913
2839
@@ -3400,14 +3326,6 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetNativeHandle(
3400
3326
return result;
3401
3327
}
3402
3328
3403
- try {
3404
- // convert platform handle to loader handle
3405
- *phNativeKernel = reinterpret_cast <ur_native_handle_t >(
3406
- ur_native_factory.getInstance (*phNativeKernel, dditable));
3407
- } catch (std::bad_alloc &) {
3408
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
3409
- }
3410
-
3411
3329
return result;
3412
3330
}
3413
3331
@@ -3427,18 +3345,13 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreateWithNativeHandle(
3427
3345
ur_result_t result = UR_RESULT_SUCCESS;
3428
3346
3429
3347
// extract platform's function pointer table
3430
- auto dditable =
3431
- reinterpret_cast <ur_native_object_t *>(hNativeKernel)->dditable ;
3348
+ auto dditable = reinterpret_cast <ur_context_object_t *>(hContext)->dditable ;
3432
3349
auto pfnCreateWithNativeHandle =
3433
3350
dditable->ur .Kernel .pfnCreateWithNativeHandle ;
3434
3351
if (nullptr == pfnCreateWithNativeHandle) {
3435
3352
return UR_RESULT_ERROR_UNINITIALIZED;
3436
3353
}
3437
3354
3438
- // convert loader handle to platform handle
3439
- hNativeKernel =
3440
- reinterpret_cast <ur_native_object_t *>(hNativeKernel)->handle ;
3441
-
3442
3355
// convert loader handle to platform handle
3443
3356
hContext = reinterpret_cast <ur_context_object_t *>(hContext)->handle ;
3444
3357
@@ -3668,14 +3581,6 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetNativeHandle(
3668
3581
return result;
3669
3582
}
3670
3583
3671
- try {
3672
- // convert platform handle to loader handle
3673
- *phNativeQueue = reinterpret_cast <ur_native_handle_t >(
3674
- ur_native_factory.getInstance (*phNativeQueue, dditable));
3675
- } catch (std::bad_alloc &) {
3676
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
3677
- }
3678
-
3679
3584
return result;
3680
3585
}
3681
3586
@@ -3694,17 +3599,13 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreateWithNativeHandle(
3694
3599
ur_result_t result = UR_RESULT_SUCCESS;
3695
3600
3696
3601
// extract platform's function pointer table
3697
- auto dditable =
3698
- reinterpret_cast <ur_native_object_t *>(hNativeQueue)->dditable ;
3602
+ auto dditable = reinterpret_cast <ur_context_object_t *>(hContext)->dditable ;
3699
3603
auto pfnCreateWithNativeHandle =
3700
3604
dditable->ur .Queue .pfnCreateWithNativeHandle ;
3701
3605
if (nullptr == pfnCreateWithNativeHandle) {
3702
3606
return UR_RESULT_ERROR_UNINITIALIZED;
3703
3607
}
3704
3608
3705
- // convert loader handle to platform handle
3706
- hNativeQueue = reinterpret_cast <ur_native_object_t *>(hNativeQueue)->handle ;
3707
-
3708
3609
// convert loader handle to platform handle
3709
3610
hContext = reinterpret_cast <ur_context_object_t *>(hContext)->handle ;
3710
3611
@@ -3985,14 +3886,6 @@ __urdlllocal ur_result_t UR_APICALL urEventGetNativeHandle(
3985
3886
return result;
3986
3887
}
3987
3888
3988
- try {
3989
- // convert platform handle to loader handle
3990
- *phNativeEvent = reinterpret_cast <ur_native_handle_t >(
3991
- ur_native_factory.getInstance (*phNativeEvent, dditable));
3992
- } catch (std::bad_alloc &) {
3993
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
3994
- }
3995
-
3996
3889
return result;
3997
3890
}
3998
3891
@@ -4010,17 +3903,13 @@ __urdlllocal ur_result_t UR_APICALL urEventCreateWithNativeHandle(
4010
3903
ur_result_t result = UR_RESULT_SUCCESS;
4011
3904
4012
3905
// extract platform's function pointer table
4013
- auto dditable =
4014
- reinterpret_cast <ur_native_object_t *>(hNativeEvent)->dditable ;
3906
+ auto dditable = reinterpret_cast <ur_context_object_t *>(hContext)->dditable ;
4015
3907
auto pfnCreateWithNativeHandle =
4016
3908
dditable->ur .Event .pfnCreateWithNativeHandle ;
4017
3909
if (nullptr == pfnCreateWithNativeHandle) {
4018
3910
return UR_RESULT_ERROR_UNINITIALIZED;
4019
3911
}
4020
3912
4021
- // convert loader handle to platform handle
4022
- hNativeEvent = reinterpret_cast <ur_native_object_t *>(hNativeEvent)->handle ;
4023
-
4024
3913
// convert loader handle to platform handle
4025
3914
hContext = reinterpret_cast <ur_context_object_t *>(hContext)->handle ;
4026
3915
@@ -9099,4 +8988,4 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetDeviceProcAddrTable(
9099
8988
9100
8989
#if defined(__cplusplus)
9101
8990
}
9102
- #endif
8991
+ #endif
0 commit comments