@@ -430,116 +430,117 @@ bool DPCTLDevice_GetSubGroupIndependentForwardProgress(
430
430
return SubGroupProgress;
431
431
}
432
432
433
- uint32_t DPCTLDevice_GetPreferredVectorWidthChar (
434
- __dpctl_keep const DPCTLSyclDeviceRef DRef)
433
+ namespace
435
434
{
436
- size_t vector_width_char = 0 ;
435
+
436
+ template <typename descriptorT>
437
+ uint32_t get_uint32_descriptor (__dpctl_keep const DPCTLSyclDeviceRef DRef)
438
+ {
439
+ uint32_t descr_val = 0 ;
437
440
auto D = unwrap<device>(DRef);
438
441
if (D) {
439
442
try {
440
- vector_width_char =
441
- D->get_info <info::device::preferred_vector_width_char>();
443
+ descr_val = D->get_info <descriptorT>();
442
444
} catch (std::exception const &e) {
443
445
error_handler (e, __FILE__, __func__, __LINE__);
444
446
}
445
447
}
446
- return vector_width_char;
448
+ return descr_val;
449
+ }
450
+
451
+ } // end of anonymous namespace
452
+
453
+ uint32_t DPCTLDevice_GetPreferredVectorWidthChar (
454
+ __dpctl_keep const DPCTLSyclDeviceRef DRef)
455
+ {
456
+ return get_uint32_descriptor<info::device::preferred_vector_width_char>(
457
+ DRef);
447
458
}
448
459
449
460
uint32_t DPCTLDevice_GetPreferredVectorWidthShort (
450
461
__dpctl_keep const DPCTLSyclDeviceRef DRef)
451
462
{
452
- size_t vector_width_short = 0 ;
453
- auto D = unwrap<device>(DRef);
454
- if (D) {
455
- try {
456
- vector_width_short =
457
- D->get_info <info::device::preferred_vector_width_short>();
458
- } catch (std::exception const &e) {
459
- error_handler (e, __FILE__, __func__, __LINE__);
460
- }
461
- }
462
- return vector_width_short;
463
+ return get_uint32_descriptor<info::device::preferred_vector_width_short>(
464
+ DRef);
463
465
}
464
466
465
467
uint32_t DPCTLDevice_GetPreferredVectorWidthInt (
466
468
__dpctl_keep const DPCTLSyclDeviceRef DRef)
467
469
{
468
- size_t vector_width_int = 0 ;
469
- auto D = unwrap<device>(DRef);
470
- if (D) {
471
- try {
472
- vector_width_int =
473
- D->get_info <info::device::preferred_vector_width_int>();
474
- } catch (std::exception const &e) {
475
- error_handler (e, __FILE__, __func__, __LINE__);
476
- }
477
- }
478
- return vector_width_int;
470
+ return get_uint32_descriptor<info::device::preferred_vector_width_int>(
471
+ DRef);
479
472
}
480
473
481
474
uint32_t DPCTLDevice_GetPreferredVectorWidthLong (
482
475
__dpctl_keep const DPCTLSyclDeviceRef DRef)
483
476
{
484
- size_t vector_width_long = 0 ;
485
- auto D = unwrap<device>(DRef);
486
- if (D) {
487
- try {
488
- vector_width_long =
489
- D->get_info <info::device::preferred_vector_width_long>();
490
- } catch (std::exception const &e) {
491
- error_handler (e, __FILE__, __func__, __LINE__);
492
- }
493
- }
494
- return vector_width_long;
477
+ return get_uint32_descriptor<info::device::preferred_vector_width_long>(
478
+ DRef);
495
479
}
496
480
497
481
uint32_t DPCTLDevice_GetPreferredVectorWidthFloat (
498
482
__dpctl_keep const DPCTLSyclDeviceRef DRef)
499
483
{
500
- size_t vector_width_float = 0 ;
501
- auto D = unwrap<device>(DRef);
502
- if (D) {
503
- try {
504
- vector_width_float =
505
- D->get_info <info::device::preferred_vector_width_float>();
506
- } catch (std::exception const &e) {
507
- error_handler (e, __FILE__, __func__, __LINE__);
508
- }
509
- }
510
- return vector_width_float;
484
+ return get_uint32_descriptor<info::device::preferred_vector_width_float>(
485
+ DRef);
511
486
}
512
487
513
488
uint32_t DPCTLDevice_GetPreferredVectorWidthDouble (
514
489
__dpctl_keep const DPCTLSyclDeviceRef DRef)
515
490
{
516
- size_t vector_width_double = 0 ;
517
- auto D = unwrap<device>(DRef);
518
- if (D) {
519
- try {
520
- vector_width_double =
521
- D->get_info <info::device::preferred_vector_width_double>();
522
- } catch (std::exception const &e) {
523
- error_handler (e, __FILE__, __func__, __LINE__);
524
- }
525
- }
526
- return vector_width_double;
491
+ return get_uint32_descriptor<info::device::preferred_vector_width_double>(
492
+ DRef);
527
493
}
528
494
529
495
uint32_t DPCTLDevice_GetPreferredVectorWidthHalf (
530
496
__dpctl_keep const DPCTLSyclDeviceRef DRef)
531
497
{
532
- size_t vector_width_half = 0 ;
533
- auto D = unwrap<device>(DRef);
534
- if (D) {
535
- try {
536
- vector_width_half =
537
- D->get_info <info::device::preferred_vector_width_half>();
538
- } catch (std::exception const &e) {
539
- error_handler (e, __FILE__, __func__, __LINE__);
540
- }
541
- }
542
- return vector_width_half;
498
+ return get_uint32_descriptor<info::device::preferred_vector_width_half>(
499
+ DRef);
500
+ }
501
+
502
+ //
503
+ uint32_t
504
+ DPCTLDevice_GetNativeVectorWidthChar (__dpctl_keep const DPCTLSyclDeviceRef DRef)
505
+ {
506
+ return get_uint32_descriptor<info::device::native_vector_width_char>(DRef);
507
+ }
508
+
509
+ uint32_t DPCTLDevice_GetNativeVectorWidthShort (
510
+ __dpctl_keep const DPCTLSyclDeviceRef DRef)
511
+ {
512
+ return get_uint32_descriptor<info::device::native_vector_width_short>(DRef);
513
+ }
514
+
515
+ uint32_t
516
+ DPCTLDevice_GetNativeVectorWidthInt (__dpctl_keep const DPCTLSyclDeviceRef DRef)
517
+ {
518
+ return get_uint32_descriptor<info::device::native_vector_width_int>(DRef);
519
+ }
520
+
521
+ uint32_t
522
+ DPCTLDevice_GetNativeVectorWidthLong (__dpctl_keep const DPCTLSyclDeviceRef DRef)
523
+ {
524
+ return get_uint32_descriptor<info::device::native_vector_width_long>(DRef);
525
+ }
526
+
527
+ uint32_t DPCTLDevice_GetNativeVectorWidthFloat (
528
+ __dpctl_keep const DPCTLSyclDeviceRef DRef)
529
+ {
530
+ return get_uint32_descriptor<info::device::native_vector_width_float>(DRef);
531
+ }
532
+
533
+ uint32_t DPCTLDevice_GetNativeVectorWidthDouble (
534
+ __dpctl_keep const DPCTLSyclDeviceRef DRef)
535
+ {
536
+ return get_uint32_descriptor<info::device::native_vector_width_double>(
537
+ DRef);
538
+ }
539
+
540
+ uint32_t
541
+ DPCTLDevice_GetNativeVectorWidthHalf (__dpctl_keep const DPCTLSyclDeviceRef DRef)
542
+ {
543
+ return get_uint32_descriptor<info::device::native_vector_width_half>(DRef);
543
544
}
544
545
545
546
__dpctl_give DPCTLSyclDeviceRef
0 commit comments