This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Trouble pipelining loop on c66x multicore DSP

Hi,

I have some trouble to pipeline my loops. here is the code of type of loops I have to pipeline:

	int sizex = 256;
	int sizey = 256;
	int nb = 3;
	uint16_t P[256*256];
	uint16_t H[256*256];

	uint16_t * restrict in  = P;
	uint16_t * restrict out = H;
	uint16_t steps[7]={ 290 ,  3539 ,  15862 ,  26154 ,  15862  , 3539 , 290};
	int x, y;	/*position in image of current pixels*/
	int i;		/*iterate over pixels*/
	int s;		/*iterate over steps*/
	uint32_t tmp;	/*accumulator*/

	for(y=0; y<sizey; y++)
	{
		/*left border*/
		for(x=0; x<nb; x++)
		{
			tmp = 0;
			for(i=0, s=(nb-x); i<(nb + x + 1); i++, s++)
			{
				tmp += (uint32_t)in[y*sizex + i]*steps[s];
			}
			*out++ = tmp>>16;
		}

		/*nominal case*/
		for(x=nb; x<(sizex-nb); x++)
		{
			tmp = 0;
			for(i=(x-nb), s=0; i<=(x+nb); i++, s++)
			{
				tmp += (uint32_t)in[y*sizex + i]*steps[s];

			}
			*out++ = tmp>>16;
		}

		/*right border*/
		for(x=(sizex-nb); x<sizex; x++)
		{
			tmp = 0;
			for(i=x-nb, s=0; i<sizex; i++, s++)
			{
				tmp += (uint32_t)in[y*sizex + i]*steps[s];
			}
			*out++ = tmp>>16;
		}
	}

Then, I have this after building my project.

;*----------------------------------------------------------------------------*
;*   SOFTWARE PIPELINE INFORMATION
;*      Disqualified loop: Loop contains control code
;*          (Performance) Loop at line 47 cannot be scheduled efficiently, as it contains complex conditional expression. Try to simplify condition.
;*----------------------------------------------------------------------------*

Here is my configuration:

-mv6600 -O3 --opt_for_speed=5 --include_path="/home/gugautie/ti/ccsv6/tools/compiler/ti-cgt-c6000_8.1.0/include" --include_path="/home/gugautie/ti/dsplib_c66x_3_1_0_0/inc" --include_path="/home/gugautie/ti/imglib_c66x_3_1_1_0/inc" --include_path="/home/gugautie/ti/mathlib_c66x_3_0_1_1/inc" --advice:performance=all -g --diag_wrap=off --diag_warning=225 --debug_software_pipeline --auto_inline=0 --openmp --gen_profile_info -k --asm_listing

Why the compilator can't pipeline my loop?


Thanks for your time,


Guillaume

  • Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com). Please read all the links below my signature.

    We will get back to you on the above query shortly. Thank you for your patience.

    Note: We strongly recommend you to create new e2e thread for your queries instead of following up on an old/closed e2e thread, new threads gets more attention than old threads and can provide link of old threads or information on the new post for clarity and faster response.

  • Guillaume,

    Moved this thread over TI Compiler forum for faster and appropriate response. Thank you.
  • Do not use the option --gen_profile_info.  That option is used to create an instrumented executable.  This executable contains extra code inserted by the compiler for the purpose of profiling the code.  Never use this option when doing a production build.  When that option is removed, then all of the loops software pipeline.

    Thanks and regards,

    -George

  • Hi,

    Thanks a lot, now the loops are pipelined but when I try to run with the option removed, I get this error:

    Exception at 0xc3ba3b4
    EFR=0x2 NRP=0xc3ba3b4
    Internal exception: IERR=0x10
    Resource conflict exception
    ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x0c3ba3b4, sp = 0x10847ef0.
    To see [C66xx_6] lict exception
    ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x0c3ba3b4, sp = 0x168480d0.
    To[C66xx_0] more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
    xdc.runtime.Error.raise: terminating execution
    [C66xx_6]  see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
    xdc.runtime.Error.raise: terminating execution
    [C66xx_1]  A13=0xc3e3ba4
    A14=0xc3d98a4 A15=0x28264220
    A16=0x9894 A17=0x0
    A18=0xfc A19=0x0
    A20=0xc239048 A21=0xc261188
    A22=0xc3bcc84 A23=0xc3bcc38
    A24=0xc2b13d8 A25=0xc2b140a
    A26=0x88190c80 A27=0xc2892c8
    A28=0x28140 A29=0x1
    A30=0x1845008 A31=0x1840000
    B0=0x0 B1=0x0
    B[C66xx_2] 2ab8 A13=0xc3e3ba4
    A14=0xc3d98a4 A15=0x2d868eaf
    A16=0xffffffff A17=0x852ab0
    A18=0xc3b9e48 A19=0xc379a48
    A20=0x805008 A21=0xc3e8fa8
    A22=0xc36a910 A23=0xc36a908
    A24=0xc2d9518 A25=0xc2d954a
    A26=0x88209040 A27=0xc2b1408
    A28=0x28140 A29=0x1
    A30=0x1845008 A31=0x[C66xx_3]  A11=0x10847f58
    A12=0x852ab8 A13=0xc3e3ba4
    A14=0xc3d98a4 A15=0x77c1f7fd
    A16=0xffffffff A17=0x852ab0
    A18=0xc3b9e48 A19=0xc379a48
    A20=0x805008 A21=0xc3e8fa8
    A22=0xc36f910 A23=0xc36f908
    A24=0x38 A25=0x38
    A26=0x38 A27=0x38
    A28=0x38 A29=0x1
    A30=0x1845008 A31=0x[C66xx_4] 8 A13=0xc3e3ba4
    A14=0xc3d98a4 A15=0x2522c060
    A16=0xffffffff A17=0x852ab0
    A18=0xa0000440 A19=0x8
    A20=0x805008 A21=0xc3e8fa8
    A22=0xc374910 A23=0xc374908
    A24=0xc301658 A25=0xc30168a
    A26=0x88281400 A27=0xc2d9548
    A28=0x28140 A29=0x1
    A30=0x1845008 A31=0x1840000
    [C66xx_5] 
    A12=0x852ab8 A13=0xc3e3ba4
    A14=0xc3d98a4 A15=0xa
    A16=0xeb44 A17=0x0
    A18=0xc3b9e48 A19=0xc379a48
    A20=0xc239048 A21=0xc261188
    A22=0xc3bcc84 A23=0xc3bcc38
    A24=0xc329798 A25=0xc3297ca
    A26=0x882a9540 A27=0xc301688
    A28=0x28140 A29=0x1
    A30=0x1845008 A31=0x184000[C66xx_7]  A13=0xc3e3ba4
    A14=0xc3d98a4 A15=0x125608a5
    A16=0xbc04 A17=0x0
    A18=0xfc A19=0x0
    A20=0xc239048 A21=0xc261188
    A22=0xc3bcc84 A23=0xc3bcc38
    A24=0xc289298 A25=0xc2892ca
    A26=0x881188c0 A27=0xc261188
    A28=0x28140 A29=0x1
    A30=0x1845008 A31=0x1840000
    B0=0x0 B1=0x0
    B[C66xx_1] 2=0x28f3a6e B3=0x852b11
    B4=0x8 B5=0x0
    B6=0x10847ef4 B7=0xc3e7694
    B8=0x2ecd51 B9=0xfffffff0
    B10=0xc3e49c0 B11=0xc3e3ba4
    B12=0x0 B13=0xc3e4a2c
    B14=0xc020000 B15=0x118480e8
    B16=0x0 B17=0x19
    B18=0x1b0 B19=0xc1e8dc8
    B20=0x1a537d9 B21=0xc120788
    B22=0x0 B23=0x0
    B[C66xx_2] 1840000
    B0=0x1600 B1=0x1
    B2=0x118cfe6 B3=0xc3ba4ec
    B4=0xfc3d B5=0x0
    B6=0xc3b9a48 B7=0xc3e7694
    B8=0xd1d512e B9=0xfffffff0
    B10=0x119ccfe6 B11=0x852b11
    B12=0x0 B13=0xc3e4a2c
    B14=0xc020000 B15=0x128480d0
    B16=0x0 B17=0x0
    B18=0x0 B19=0x0
    B20=0x1766a88 B21=0xc3b9[C66xx_3] 1840000
    B0=0x1600 B1=0x1
    B2=0x1766a88 B3=0xc3ba4ec
    B4=0xfc3d B5=0x0
    B6=0xc3b9a48 B7=0xc3e7694
    B8=0xd7aebd0 B9=0xfffffff0
    B10=0x11fa6a88 B11=0x852b11
    B12=0x0 B13=0xc3e4a2c
    B14=0xc020000 B15=0x138480d0
    B16=0x0 B17=0x0
    B18=0x0 B19=0x0
    B20=0x1a537d9 B21=0xc3b9[C66xx_4] B0=0x0 B1=0x0
    B2=0x1d4052a B3=0x852b11
    B4=0x8 B5=0x0
    B6=0x10847ef4 B7=0xc3e7694
    B8=0x2ecd51 B9=0xfffffff0
    B10=0xc3e49c0 B11=0xc3e3ba4
    B12=0x0 B13=0xc3e4a2c
    B14=0xc020000 B15=0x148480e8
    B16=0x0 B17=0x0
    B18=0x0 B19=0x0
    B20=0x1a537d9 B21=0x0
    B22=0x0 B23=0x0
    B[C66xx_5] 0
    B0=0x1600 B1=0x1
    B2=0x5d9aa2 B3=0xc3ba4ec
    B4=0xfc3d B5=0x0
    B6=0xc3b9a48 B7=0xc3e7694
    B8=0xc621bea B9=0xfffffff0
    B10=0x10e19aa2 B11=0x852b11
    B12=0x0 B13=0xc3e4a2c
    B14=0xc020000 B15=0x158480d0
    B16=0x0 B17=0x4
    B18=0x1b0 B19=0xc170a08
    B20=0xbb3544 B21=0xc3b9[C66xx_7] 2=0x2319fcc B3=0x852b11
    B4=0x8 B5=0x0
    B6=0x10847ef4 B7=0xc3e7694
    B8=0x2ecd51 B9=0xfffffff0
    B10=0xc3e49c0 B11=0xc3e3ba4
    B12=0x0 B13=0xc3e4a2c
    B14=0xc020000 B15=0x178480e8
    B16=0x0 B17=0x10
    B18=0x1b0 B19=0xc1c0c88
    B20=0x1a537d9 B21=0xc0f8648
    B22=0x0 B23=0x0
    B[C66xx_1] 24=0x0 B25=0x0
    B26=0x12c922 B27=0x46f1
    B28=0x12c922 B29=0x46f1
    B30=0x12c922 B31=0x0
    NTSR=0x1000c
    ITSR=0x0
    IRP=0x0
    SSR=0x0
    AMR=0x0
    RILC=0x0
    ILC=0x0
    Exception at 0x852b10
    EFR=0x2 NRP=0x852b10
    Internal exception: IERR=0x12
    Fetch packet exception
    Resource conf[C66xx_2] a48
    B22=0x0 B23=0x0
    B24=0x0 B25=0x0
    B26=0x12c922 B27=0x46f1
    B28=0x12c922 B29=0x46f1
    B30=0x12c922 B31=0x0
    NTSR=0x1800c
    ITSR=0x0
    IRP=0x0
    SSR=0x0
    AMR=0x0
    RILC=0x0
    ILC=0x0
    Exception at 0xc3ba3b4
    EFR=0x2 NRP=0xc3ba3b4
    Internal exception: IERR=0x10
    Resource conf[C66xx_3] a48
    B22=0x0 B23=0x0
    B24=0x0 B25=0x0
    B26=0x12c922 B27=0x46f1
    B28=0x12c922 B29=0x46f1
    B30=0x12c922 B31=0x0
    NTSR=0x1800c
    ITSR=0x0
    IRP=0x0
    SSR=0x0
    AMR=0x0
    RILC=0x0
    ILC=0x0
    Exception at 0xc3ba3b4
    EFR=0x2 NRP=0xc3ba3b4
    Internal exception: IERR=0x10
    Resource conf[C66xx_4] 24=0x0 B25=0x0
    B26=0x12c922 B27=0x46f1
    B28=0x12c922 B29=0x46f1
    B30=0x12c922 B31=0x0
    NTSR=0x1000c
    ITSR=0x0
    IRP=0x0
    SSR=0x0
    AMR=0x0
    RILC=0x0
    ILC=0x0
    Exception at 0x852b10
    EFR=0x2 NRP=0x852b10
    Internal exception: IERR=0x12
    Fetch packet exception
    Resource conf[C66xx_5] a48
    B22=0x0 B23=0x0
    B24=0x0 B25=0x0
    B26=0x12c922 B27=0x46f1
    B28=0x12c922 B29=0x46f1
    B30=0x12c922 B31=0x0
    NTSR=0x1800c
    ITSR=0x0
    IRP=0x0
    SSR=0x0
    AMR=0x0
    RILC=0x0
    ILC=0x0
    Exception at 0xc3ba3b4
    EFR=0x2 NRP=0xc3ba3b4
    Internal exception: IERR=0x10
    Resource conf[C66xx_7] 24=0x0 B25=0x0
    B26=0x12c922 B27=0x46f1
    B28=0x12c922 B29=0x46f1
    B30=0x12c922 B31=0x0
    NTSR=0x1000c
    ITSR=0x0
    IRP=0x0
    SSR=0x0
    AMR=0x0
    RILC=0x0
    ILC=0x0
    Exception at 0x852b10
    EFR=0x2 NRP=0x852b10
    Internal exception: IERR=0x12
    Fetch packet exception
    Resource conf[C66xx_1] lict exception
    ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x00852b10, sp = 0x118480e8.
    To see more exception detail, [C66xx_2] lict exception
    ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x0c3ba3b4, sp = 0x128480d0.
    T[C66xx_3] lict exception
    ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x0c3ba3b4, sp = 0x138480d0.
    To see more exception det[C66xx_4] lict exception
    ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x00852b10, sp = 0x148480e8.
    To see more exception detail, use[C66xx_5] lict exception
    ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x0c3ba3b4, sp = 0x158480d0.
    To see mor[C66xx_7] lict exception
    ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x00852b10, sp = 0x178480e8.
    To see more exception detail, [C66xx_1] use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
    xdc.runtime.Error.raise: terminating execution
    [C66xx_2] o see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
    xdc.runtime.Error.raise: terminating execution
    [C66xx_3] ail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
    xdc.runtime.Error.raise: terminating execution
    [C66xx_4]  ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
    xdc.runtime.Error.raise: terminating execution
    [C66xx_5] e exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
    xdc.runtime.Error.raise: terminating execution
    [C66xx_7] use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
    xdc.runtime.Error.raise: terminating execution
    

    Guillaume

  • Hi Guillaume,

    The kernel caught an exception. Can you look at the call stack in CCS->Tools->RTOS Object Viewer->Hwi->Exception tab? This will show you where it occurred. There's this training video/pdf that discusses exceptions also: https://training.ti.com/debugging-common-application-issues-ti-rtos

    Todd