Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 50590d59 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

descriptor: protect datatype from mixed flag

parent 97288236
No related branches found
No related tags found
1 merge request!395Introduce half-precision conversion and gemm kernels for GPUs
...@@ -91,6 +91,7 @@ int chameleon_desc_mat_free( CHAM_desc_t *desc ) ...@@ -91,6 +91,7 @@ int chameleon_desc_mat_free( CHAM_desc_t *desc )
void chameleon_desc_init_tiles( CHAM_desc_t *desc, blkrankof_fct_t rankof ) void chameleon_desc_init_tiles( CHAM_desc_t *desc, blkrankof_fct_t rankof )
{ {
CHAM_tile_t *tile; CHAM_tile_t *tile;
int8_t flttype = cham_get_flttype( desc->dtyp );
int ii, jj; int ii, jj;
assert( rankof != chameleon_getrankof_tile ); assert( rankof != chameleon_getrankof_tile );
...@@ -101,7 +102,7 @@ void chameleon_desc_init_tiles( CHAM_desc_t *desc, blkrankof_fct_t rankof ) ...@@ -101,7 +102,7 @@ void chameleon_desc_init_tiles( CHAM_desc_t *desc, blkrankof_fct_t rankof )
for( ii=0; ii<desc->lmt; ii++, tile++ ) { for( ii=0; ii<desc->lmt; ii++, tile++ ) {
int rank = rankof( desc, ii, jj ); int rank = rankof( desc, ii, jj );
tile->format = CHAMELEON_TILE_FULLRANK; tile->format = CHAMELEON_TILE_FULLRANK;
tile->flttype = (int8_t)(desc->dtyp); tile->flttype = flttype;
tile->rank = rank; tile->rank = rank;
tile->m = ii == desc->lmt-1 ? desc->lm - ii * desc->mb : desc->mb; tile->m = ii == desc->lmt-1 ? desc->lm - ii * desc->mb : desc->mb;
tile->n = jj == desc->lnt-1 ? desc->ln - jj * desc->nb : desc->nb; tile->n = jj == desc->lnt-1 ? desc->ln - jj * desc->nb : desc->nb;
...@@ -368,6 +369,8 @@ void chameleon_desc_destroy( CHAM_desc_t *desc ) ...@@ -368,6 +369,8 @@ void chameleon_desc_destroy( CHAM_desc_t *desc )
*/ */
int chameleon_desc_check(const CHAM_desc_t *desc) int chameleon_desc_check(const CHAM_desc_t *desc)
{ {
cham_flttype_t flttype;
if (desc == NULL) { if (desc == NULL) {
chameleon_error("chameleon_desc_check", "NULL descriptor"); chameleon_error("chameleon_desc_check", "NULL descriptor");
return CHAMELEON_ERR_NOT_INITIALIZED; return CHAMELEON_ERR_NOT_INITIALIZED;
...@@ -376,13 +379,15 @@ int chameleon_desc_check(const CHAM_desc_t *desc) ...@@ -376,13 +379,15 @@ int chameleon_desc_check(const CHAM_desc_t *desc)
chameleon_error("chameleon_desc_check", "NULL matrix pointer"); chameleon_error("chameleon_desc_check", "NULL matrix pointer");
return CHAMELEON_ERR_UNALLOCATED; return CHAMELEON_ERR_UNALLOCATED;
} }
if ( (desc->dtyp != ChamInteger ) &&
(desc->dtyp != ChamRealHalf ) && flttype = cham_get_flttype( desc->dtyp );
(desc->dtyp != ChamRealFloat ) && if ( (flttype != ChamInteger ) &&
(desc->dtyp != ChamRealDouble ) && (flttype != ChamRealHalf ) &&
(desc->dtyp != ChamComplexHalf ) && (flttype != ChamRealFloat ) &&
(desc->dtyp != ChamComplexFloat ) && (flttype != ChamRealDouble ) &&
(desc->dtyp != ChamComplexDouble ) ) (flttype != ChamComplexHalf ) &&
(flttype != ChamComplexFloat ) &&
(flttype != ChamComplexDouble ) )
{ {
chameleon_error("chameleon_desc_check", "invalid matrix type"); chameleon_error("chameleon_desc_check", "invalid matrix type");
return CHAMELEON_ERR_ILLEGAL_VALUE; return CHAMELEON_ERR_ILLEGAL_VALUE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment