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.

[C6000 CGT 7.4.x] --preferred_order linker option does not work

Hello,

When I specify --preferred_order option to linker, CCS hangup.
Please note the build process succeeded when I deleted --preferred_order options. Also, when I tried this with CGTv7.4.0 and 7.4.14 on CCS 5.3/6.1, the problem was still existing. How can I solve this problem ?

Background:
I'm trying to use clt6x to get better performance in L1P cache. 
Please take a look at 3.9.5 Program Instruction Cache Layout Development Flow in TMS320C6000 Optimizing Compiler v7.x user guide.
By following the manual, I succeeded to generate forder.cmd file and I'm now going into the final step to apply the generated forder.cmd to my application.
The forder.cmd looks like this :

--preferred_order="platform_init"
--preferred_order="Qmss_insertMemoryRegion"
--preferred_order="Cppi_init"
--preferred_order="Qmss_init"
--preferred_order="../bench_qmss.c:CACHE_getL2Size"
--preferred_order="../bench_qmss.c:CACHE_getL1DSize"
--preferred_order="getStats"
--preferred_order="MessageQ_free"
--preferred_order="MessageQ_alloc"
--preferred_order="MessageQ_create"
--preferred_order="MultiProc_getName"
--preferred_order="ti_sysbios_BIOS_getCpuFreq__E"
--preferred_order="memset"
--preferred_order="initPlatform"
.....

As you see, this command file is just a sequence of --preferred_order of functions. So, I just added this command file to my project tree and then I built my project. The compilation phase looked completed successfully, but in link phase, CCS got stuck.
The following is CCS console log during the link phase. 

'Building target: qmssIpcBenchmark_c6678.out'
'Invoking: C6000 Linker'
"C:/ti/c6000_7.4.14/bin/cl6x" -mv6600 --abi=eabi -g --display_error_number --diag_warning=225 --gen_func_subsections=on -z -m"qmssIpcBenchmark_c6678.map" -i"C:/ti/c6000_7.4.14/lib" -i"C:/ti/c6000_7.4.14/include" --reread_libs --warn_sections --xml_link_info="qmssIpcBenchmark_c6678_linkInfo.xml" --rom_model -o "qmssIpcBenchmark_c6678.out" "./bench_qmss.obj" "./cppi_device.obj" "./qmss_device.obj" "./common/bench_common.obj" "./common/bench_osal.obj" "../forder.cmd" -l"./configPkg/linker.cmd" -l"libc.a" 
<Linking>

Best Regards,
Naoki Kawada

  • I suspect that CCS has nothing to with this problem.  My guess is that some error in the linker is the cause.

    You can test my theory by performing the link outside of CCS.  Open a command shell such as a DOS command prompt window.  Go to the project directory that contains the object files.  The directory name will be similar to C:\Users\Your Name Here\workspace_v6_0\name of project\Debug .  Then issue the exact same link command you show above.  I suspect this command will not complete successfully.

    If I am right, then this is a problem with the linker and not CCS.  In that case, we would need a test case which allows to reproduce the behavior ourselves.  I'd appreciate if you would submit your entire project.  

    If I am wrong, then it is a problem with CCS.  At that point, I'll get help from the CCS experts.  I'm nearly certain they will also want to see your entire project.

    Thanks and regards,

    -George

  • Hi George,

    Thanks for your answer.
    You seem right, I tried your suggestions and found linker did not work correctly outside of CCS.

    I shared my project under Debug folder.All required files are in this folder except cgt libraries.
    You can recreate the issue by the following.

    4073.Debug.zip

    1. Install CGT v7.4.0 to default path (C:\ti) if it does not exist in your PC.
    2. Extract the attached delivery
    3. Open dos prompt and go to Debug directory.
    4. Issue the following command. The link process should be completed successfully.

    "C:/ti/C6000 Code Generation Tools 7.4.0/bin/cl6x" -mv6600 --abi=eabi -Ooff -g --display_error_number --diag_warning=225 --gen_func_subsections=on --analyze=callgraph --use_profile_info="./pprofout.prf" -z -m"qmssIpcBenchmark_c6678.map" -i"C:/ti/C6000 Code Generation Tools 7.4.0/lib" -i"C:/ti/C6000 Code Generation Tools 7.4.0/include" --reread_libs --warn_sections --rom_model -o "qmssIpcBenchmark_c6678.out" -l"./configPkg/linker.cmd" "./common/bench_osal.obj" "./common/bench_common.obj" "./qmss_device.obj" "./cppi_device.obj" "./bench_qmss.obj" -l"libc.a"

    4. Now, "./forder.cmd" is newly added to the above command sequence. Issue the following commands.

    "C:/ti/C6000 Code Generation Tools 7.4.0/bin/cl6x" -mv6600 --abi=eabi -Ooff -g --display_error_number --diag_warning=225 --gen_func_subsections=on --analyze=callgraph --use_profile_info="./pprofout.prf" -z -m"qmssIpcBenchmark_c6678.map" -i"C:/ti/C6000 Code Generation Tools 7.4.0/lib" -i"C:/ti/C6000 Code Generation Tools 7.4.0/include" --reread_libs --warn_sections --rom_model -o "qmssIpcBenchmark_c6678.out" -l"./configPkg/linker.cmd" "./common/bench_osal.obj" "./common/bench_common.obj" "./qmss_device.obj" "./cppi_device.obj" "./bench_qmss.obj" -l"libc.a" "./forder.cmd"

    And then, the control is never returned from linker....

    Best Regards,
    Naoki Kawada

  • Thank you for submitting a test case.  I realize that is particularly difficult in the case of a linker problem.  I can reproduce the same behavior.  I submitted SDSCM00052251 in the SDOWP system to have this investigated.  Feel free to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George

  • Hello George,

    Thanks for your confirmation and submitting a report to your clearquest.
    Can I understand you will follow up this issue and update this thread if the workaround is available ?

    Also, I have a quick question related to this issue -- it is about the differences between --analyze=callgraph and --analyze=codecov.
    Actually, I could generate the executable with these options. And the correctness of executable looked ok with a bit higher performance in execution time.
    But honesty speaking, I could not understand the exact differences between --analyze=callgraph and --analyze=codecov.

    User guide says codecov option will generate code coverage information and apply profile based optimization to executable. Can you explain what type of optimization will be applied ? As for callgraph option, I think it will be used to generate weighted call graph csv file. The csv file will be post processed by clt6x
    to create link command file with --preferred_order option sequence. This command file will be used to optimize memory layout for fewer cache line conflicts in L1P. 
    Please correct me if i'm wrong.

    Best Regards,
    Naoki Kawada

  • Naoki Kawada said:
    Can I understand you will follow up this issue and update this thread if the workaround is available ?

    Unfortunately, no.  I file too many issues to follow them all like that.  Customer feedback on an issue is provided through the SDOWP link below in my signature.

    Naoki Kawada said:
    Also, I have a quick question related to this issue -- it is about the differences between --analyze=callgraph and --analyze=codecov.
    Actually, I could generate the executable with these options. And the correctness of executable looked ok with a bit higher performance in execution time.

    When you build with --use_profile_info, the compiler always uses the information collected by the instrumented runs to make better decisions regarding optimization.  You can also ask the compiler to generate one additional output.

    If you use --analyze=callgraph, that additional output is a .csv file that contains a call graph.  This .csv file is the input to the cache layout tool clt6x.  The output of clt6x is a linker command file with a list of --preferred_order linker options in it.  You use that to tell the linker to place the functions in memory in that order.   This ordering of functions improves performance of L1P (level one program memory) cache.  A full discussion can be found in this wiki article.

    If you use --analyze=codecov, that additional output is a .csv file that contains information on code coverage.  It tells you how many times a line of source executed.  TI does not provide any viewer for this .csv file.  Most users load it into Excel.  

    Thanks and regards,

    -George