@@ -49,21 +49,58 @@ infiniStatus_t Descriptor::calculate(
4949 const ptrdiff_t incy = _info.getIncy ();
5050 const infiniDtype_t data_type = _info.getDtype ();
5151
52+ hpccDataType alpha_type, x_type, y_type;
53+ hpccDataType execution_type;
54+
55+ switch (data_type) {
56+ case INFINI_DTYPE_F16 :
57+ alpha_type = x_type = y_type = HPCC_R_16F ;
58+ execution_type = HPCC_R_32F ;
59+ break ;
60+ case INFINI_DTYPE_BF16 :
61+ alpha_type = x_type = y_type = HPCC_R_16BF ;
62+ execution_type = HPCC_R_32F ;
63+ break ;
64+ case INFINI_DTYPE_F32 :
65+ alpha_type = x_type = y_type = HPCC_R_32F ;
66+ execution_type = HPCC_R_32F ;
67+ break ;
68+ case INFINI_DTYPE_F64 :
69+ alpha_type = x_type = y_type = HPCC_R_64F ;
70+ execution_type = HPCC_R_64F ;
71+ break ;
72+ default :
73+ return INFINI_STATUS_BAD_TENSOR_DTYPE ;
74+ }
75+
5276 CHECK_STATUS (_opaque->internal ->useMcblas (
5377 (hcStream_t)stream,
5478 [&](hcblasHandle_t handle) {
5579 CHECK_MCBLAS (hcblasSetPointerMode (handle, HCBLAS_POINTER_MODE_DEVICE ));
5680
57- switch (data_type) {
58- case INFINI_DTYPE_F32 :
59- CHECK_MCBLAS (hcblasSaxpy (handle, size, (const float *)alpha, (const float *)x, incx, (float *)y, incy));
60- break ;
61- case INFINI_DTYPE_F64 :
62- CHECK_MCBLAS (hcblasDaxpy (handle, size, (const double *)alpha, (const double *)x, incx, (double *)y, incy));
63- break ;
64- default :
65- return INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED ;
66- }
81+ // switch (data_type) {
82+ // case INFINI_DTYPE_F32:
83+ // CHECK_MCBLAS(hcblasSaxpy(handle, size, (const float *)alpha, (const float *)x, incx, (float *)y, incy));
84+ // break;
85+ // case INFINI_DTYPE_F64:
86+ // CHECK_MCBLAS(hcblasDaxpy(handle, size, (const double *)alpha, (const double *)x, incx, (double *)y, incy));
87+ // break;
88+ // default:
89+ // return INFINI_STATUS_DEVICE_TYPE_NOT_SUPPORTED;
90+ // }
91+
92+ hcblasAxpyEx (
93+ handle,
94+ size,
95+ alpha,
96+ alpha_type,
97+ x,
98+ x_type,
99+ incx,
100+ y,
101+ y_type,
102+ incy,
103+ execution_type);
67104
68105 return INFINI_STATUS_SUCCESS ;
69106 }));
0 commit comments