PowerQuad corrupts memory

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

PowerQuad corrupts memory

ソリューションへジャンプ
1,334件の閲覧回数
Peter19
Contributor II

I am running example frdmmcxn947_powerquad_cmsis and extended size a bit.

Now memory gets corrupted around the locals so it looks to me like powerquad writes outside the expected memory.

 

 

 

static void arm_mat_add_q31Example(void)
{
    uint32_t srcRows, srcColumns; /* Temporary variables */
    arm_status status;
    arm_matrix_instance_q31 addMatrixA31;
    arm_matrix_instance_q31 addMatrixB31;
    arm_matrix_instance_q31 addMatrixR;
    #define MATRIX_SIZE 32
    q31_t A31[MATRIX_SIZE]       = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32};
    q31_t B31[MATRIX_SIZE]       = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320};
    q31_t addResult[MATRIX_SIZE] = {0};
    q31_t addRef[MATRIX_SIZE]    = {11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 220, 231, 242, 253, 264, 275, 286, 297, 308, 319, 330, 341, 352};
    uint16_t rows = MATRIX_SIZE;
    uint16_t cols = 1;

    /* Initialise Matrix Instance addMatrixM1 with numRows, numCols and data array(M1) */
    srcRows    = rows;
    srcColumns = cols;
    arm_mat_init_q31(&addMatrixA31, srcRows, srcColumns, A31);

    /* Initialise Matrix Instance addMatrixM1 with numRows, numCols and data array(M1) */
    srcRows    = rows;
    srcColumns = cols;
    arm_mat_init_q31(&addMatrixB31, srcRows, srcColumns, B31);

    /* Initialise Matrix Instance addMatrixM1 with numRows, numCols and data array(M1) */
    srcRows    = rows;
    srcColumns = cols;
    arm_mat_init_q31(&addMatrixR, srcRows, srcColumns, addResult);

    status = arm_mat_add_q31(&addMatrixA31, &addMatrixB31, &addMatrixR);
    EXAMPLE_ASSERT_TRUE(status == ARM_MATH_SUCCESS);

    for (uint32_t i = 0; i < MATRIX_SIZE; i++)
    {
        EXAMPLE_ASSERT_TRUE(addRef[i] == addMatrixR.pData[i]);
    }
}

 

 

 

 

ラベル(3)
0 件の賞賛
返信
1 解決策
1,308件の閲覧回数
Celeste_Liu
NXP Employee
NXP Employee

Hello @Peter19 ,

Thanks for your post. The reason is that there are restrictions on the dimensions of the power_quad matrix operations. It only supports a maximum size of 16 * 16, and setting the row to 32 is not reasonable. You can find the detailed information in the Reference Manual. See the figure below.

Celeste_Liu_0-1736332255025.png

Hope it can help you.

BRs,

Celeste

--------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!
--------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,309件の閲覧回数
Celeste_Liu
NXP Employee
NXP Employee

Hello @Peter19 ,

Thanks for your post. The reason is that there are restrictions on the dimensions of the power_quad matrix operations. It only supports a maximum size of 16 * 16, and setting the row to 32 is not reasonable. You can find the detailed information in the Reference Manual. See the figure below.

Celeste_Liu_0-1736332255025.png

Hope it can help you.

BRs,

Celeste

--------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!
--------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
1,297件の閲覧回数
Peter19
Contributor II
Hello @Celeste_Liu
It is not obvious to me that 32x1 is not supported since it is much smaller than 16x16...
Regards
/Peter
0 件の賞賛
返信
1,274件の閲覧回数
Celeste_Liu
NXP Employee
NXP Employee

Hello @Peter19 ,

What I mean is that neither a single dimension of the matrix, be it the row or the column, can exceed 16. If you change 32x1 to 16x2, it will work. Similarly, I've tested the maximum size of 16x16 and there was no problem.

BRs,

Celeste

0 件の賞賛
返信