| 1 |
/* { dg-do run { target { ! ia32 } } } */ |
| 2 |
/* { dg-require-effective-target amx_transpose } */ |
| 3 |
/* { dg-require-effective-target amx_complex } */ |
| 4 |
/* { dg-require-effective-target avx512fp16 } */ |
| 5 |
/* { dg-options "-O2 -mamx-transpose -mamx-complex -mavx512fp16" } */ |
| 6 |
#define AMX_TRANSPOSE |
| 7 |
#define AMX_COMPLEX |
| 8 |
#define DO_TEST test_amx_transpose_conjtfp16 |
| 9 |
void test_amx_transpose_conjtfp16 (); |
| 10 |
#include "amx-helper.h" |
| 11 |
|
| 12 |
void calc_matrix_conjtfp16 (__tile *dst, __tile *src) |
| 13 |
{ |
| 14 |
uint16_t *src_buf = (uint16_t *) src->buf; |
| 15 |
float *dst_buf = (float *) dst->buf; |
| 16 |
|
| 17 |
int M = dst->rows; |
| 18 |
int N = dst->colsb / 4; |
| 19 |
int i, j, t; |
| 20 |
|
| 21 |
for (i = 0; i < M; i++) |
| 22 |
for (j = 0; j < N; j++) |
| 23 |
for (t = 0; t < 2; t+=2) |
| 24 |
{ |
| 25 |
dst_buf[i * 2 * N + 2 * j + t] = src_buf[j * 2 * M + 2 * i + t]; |
| 26 |
dst_buf[i * 2 * N + 2 * j + t + 1] = -src_buf[j * 2 * M + 2 * i + t + 1]; |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
void test_amx_transpose_conjtfp16 () |
| 31 |
{ |
| 32 |
__tilecfg_u cfg; |
| 33 |
__tile src, dst, ref; |
| 34 |
uint8_t tmp_dst_buf[1024]; |
| 35 |
|
| 36 |
init_fp16_max_tile_buffer (tmp_dst_buf); |
| 37 |
init_tile_config (&cfg); |
| 38 |
init_tile_reg_and_src_with_buffer (1, dst, tmp_dst_buf); |
| 39 |
init_tile_reg_and_src_with_buffer (2, src, tmp_dst_buf); |
| 40 |
|
| 41 |
/* Check tconjtfp16. */ |
| 42 |
calc_matrix_conjtfp16 (&dst, &src); |
| 43 |
_tile_conjtfp16 (1, 2); |
| 44 |
_tile_stored (1, ref.buf, _STRIDE); |
| 45 |
|
| 46 |
if (!check_tile_register (&ref, &dst)) |
| 47 |
abort (); |
| 48 |
} |