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 )
void chameleon_desc_init_tiles( CHAM_desc_t *desc, blkrankof_fct_t rankof )
{
CHAM_tile_t *tile;
int8_t flttype = cham_get_flttype( desc->dtyp );
int ii, jj;
assert( rankof != chameleon_getrankof_tile );
......@@ -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++ ) {
int rank = rankof( desc, ii, jj );
tile->format = CHAMELEON_TILE_FULLRANK;
tile->flttype = (int8_t)(desc->dtyp);
tile->flttype = flttype;
tile->rank = rank;
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;
......@@ -368,6 +369,8 @@ void chameleon_desc_destroy( CHAM_desc_t *desc )
*/
int chameleon_desc_check(const CHAM_desc_t *desc)
{
cham_flttype_t flttype;
if (desc == NULL) {
chameleon_error("chameleon_desc_check", "NULL descriptor");
return CHAMELEON_ERR_NOT_INITIALIZED;
......@@ -376,13 +379,15 @@ int chameleon_desc_check(const CHAM_desc_t *desc)
chameleon_error("chameleon_desc_check", "NULL matrix pointer");
return CHAMELEON_ERR_UNALLOCATED;
}
if ( (desc->dtyp != ChamInteger ) &&
(desc->dtyp != ChamRealHalf ) &&
(desc->dtyp != ChamRealFloat ) &&
(desc->dtyp != ChamRealDouble ) &&
(desc->dtyp != ChamComplexHalf ) &&
(desc->dtyp != ChamComplexFloat ) &&
(desc->dtyp != ChamComplexDouble ) )
flttype = cham_get_flttype( desc->dtyp );
if ( (flttype != ChamInteger ) &&
(flttype != ChamRealHalf ) &&
(flttype != ChamRealFloat ) &&
(flttype != ChamRealDouble ) &&
(flttype != ChamComplexHalf ) &&
(flttype != ChamComplexFloat ) &&
(flttype != ChamComplexDouble ) )
{
chameleon_error("chameleon_desc_check", "invalid matrix type");
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