C7000 C/C++ Code Generation Tools v1.3.0

Table of Contents


0 Introduction to the C7000 Code Generation Tools v1.3 STS Pre-Release


This release is an STS (Short-Term Support) pre-release. As such, it is not feature complete. Aspects of the support, including names of visible C7x intrinsics, the programming model, and the calling convention and EABI, may change over the course of the releases as feature support improves.

Definitions

We normally maintain two active branches at any given time. When a new LTS branch is made, the 2nd to last LTS releases will be made reactive.


1 Documentation


The following documents are included to provide information on how to use, program, and migrate to the C7000 CPU.

SPRUIG8B***.PDF: C7000 C/C++Optimizing Compiler Users Guide

SPRUIG4C***.PDF: C7000 Embedded Application Binary Interface (EABI) Reference Guide

SPRUIG5C***.PDF: C6000-to-C7000 Migration User’s Guide

SPRUIG3C***.PDF: VCOP Kernel-C to C7000 Migration Tool User’s Guide

SPRUIG6D***.PDF: C7000 Host Emulation User’s Guide


2 TI E2E Community - Where to get help


Questions concerning TI Code Generation Tools can be posted to the TI E2E Community forums. The “Development Tools” forum can be found at:

The following is the top-level webpage for all of TI’s Code Generation Tools.

If submitting a defect report, please attach a scaled-down test case with command-line options and the compiler version number to allow us to reproduce the issue easily.


3 Defect Tracking Database


Compiler defect reports can be tracked at the new Development Tools bug database, SIR. SIR is a JIRA-based view into all public tools defects. The old SDOWP tracking database will be retired.

A my.ti.com account is required to access this page. To find an issue in SIR, enter your defect id in the top right search box once logged in. Alternatively from the top red navigation bar, select “Issues” then “Search for Issues”.

To find an old SDOWP issue, place the SDOWP ID in the search box and use double quotes around the SDOWP ID.


4 SE/SA/MMA Interface Changes


This version of the compiler has a different interface for the streaming engine (SE), streaming address generator (SA) and to a lesser extent, the MMA. These changes involve how to setup and initialize the SE and SA and the enums used in initializing configuration registers and some intrinsics.

Existing code that uses the SE, SA, or MMA will need to be changed to use the new interfaces with this version of the compiler. See the c7x_strm.h, c7x_mma.h, c7x_he_strm.h, and c7x_he_mma.h files in the include directory for the current interface.

Here is a summary of some of the interface changes

  1. The __HWAOP and __HWAOPXFER intrinsics require an enum argument instead of a simple integer constant.
  2. The __HWA_CONFIG_REG name has changed to __HWA_CONFIG_REG_v1 to allow for additional MMA configuration templates in future devices.
  3. Some fields in the __HWA_CONFIG_REG_v1 struct now require enums instead of constants.
  4. It is recommended to use the __gen_HWA_CONFIG_REG_v1 function to set default values for any new instance of the __HWA_CONFIG_REG_v1 struct. There is a similar function, __gen_HWA_OFFSET_REG for initializing instances of the __HWA_OFFSET_REG struct.
  5. SE and SA are now configured using structure types. It is recommended to use __gen_SE_TEMPLATE_v1 and similar to initialize them.

As a temporary migration measure, the option –deprecated_api is available to expose the old API and hide the new API. This option will be removed in a future release.


5 Data Movement Intrinsic Updates


This release implements new data movement intrinsics that break compatibility with release 1.2.0 and previous versions. A data movement intrinsic is defined as an intrisic that moves data without regard for data format, such as a shuffle or deal operation. These intrinsics have been updated to only accept element types that precisely fit the data movement operation. For example, a shuffle operation that operates on 32 bit boundaries no longer accepts char vectors. In addition, any element type that may fit is now available, including complex and floating point types. For reference, the following intrinsics were affected:

This set of intrinsics has been replaced with the following set:


6 Supported and Unsupported Features


New Features

        sizeof(char64)  == 8528     sizeof(cchar32)  == 31576
        sizeof(char32)  == 4912     sizeof(cchar16)  == 19608
        sizeof(char16)  == 3040     sizeof(cchar8)   == 15560
        sizeof(char8)   == 2344     sizeof(cchar4)   == 2792
        sizeof(char4)   == 544      sizeof(cchar2)   == 456
        sizeof(char2)   == 112

        sizeof(short32) == 4944     sizeof(cshort16) == 19608
        sizeof(short16) == 3056     sizeof(cshort8)  == 15560
        sizeof(short8)  == 2352     sizeof(cshort4)  == 2792
        sizeof(short4)  == 552      sizeof(cshort2)  == 456
        sizeof(short2)  == 112

        sizeof(int16)   == 3088     sizeof(cint8)    == 15624
        sizeof(int8)    == 2368     sizeof(cint4)    == 2824
        sizeof(int4)    == 560      sizeof(cint2)    == 472
        sizeof(int2)    == 120

        sizeof(float16) == 3088     sizeof(cfloat8)  == 15624
        sizeof(float8)  == 2368     sizeof(cfloat4)  == 2824
        sizeof(float4)  == 560      sizeof(cfloat2)  == 472
        sizeof(float2)  == 120

        sizeof(long8)   == 2400     sizeof(clong4)   == 2856
        sizeof(long4)   == 576      sizeof(clong2)   == 488
        sizeof(long2)   == 128

        sizeof(double8) == 2400     sizeof(cdouble4) == 2856
        sizeof(double4) == 576      sizeof(cdouble2) == 488
        sizeof(double2) == 128

Supported Intrinsics

The included top-level header files c7x.h and c6x_migration.h list the supported intrinsics for both C7x and C6x, respectively. Note that you must include these header files with your source in order to leverage many of the C7x intrinsics and all of the legacy C6x intrinsics. c7x.h includes other useful header files that document/describe supported intrinsics:

Unsupported Features


7 Support for Vector Data Types


The C7000 v1.0.0 STS C/C++ compiler supports the use of OpenCL-like vector data types in C/C++ source files by default.


7.1 Basic Usage

Support for vector data types is available on the C7100 architecure.

Support for vector data types is enabled by default. When the “–vectypes=off” option is specified on the compiler command line, vector types will be interpreted as identifiers rather than types.

Support for vector data types requires the use of the optimizer. That is, the “–vectypes” option must be specified in combination with “-o0”, “-o1”, “-o2”, or “-o3” on the compiler command line.

All of the vector data types and related built-in functions that are supported in the C7x programming model are specified in the “c7x.h” header file that you can find in the “include” sub-directory where your C7000 CGT was installed.

Any C/C++ source file that utilizes vector data types or any of the built-in functions must “#include <c7x.h>” in that source file.


7.2 Vector Data Types and Operations

Vector Data Types

A vector type name is a concatenation of element type name with a number representing vector length. A vector with such type consists of vector length number of vector elements.

The C7x programming model implementation of vector data types and operations follows the OpenCL C language specification very closely. For a more detailed description of OpenCL vector data types and operations, please see “The OpenCL Specification” version 1.2 which is available from the Khronos OpenCL Working Group:

http://www.khronos.org/opencl/

Chapter 6, section 6.1.2 of “The OpenCL Specification” version 1.2 provides a detailed description of the built-in vector data types supported in the OpenCL C programming language.

The C7x programming model provides the following built-in vector data types:

The C7x programming model also provides an extension to the OpenCL C programming language for representing vectors of complex type. A prefix of ‘c’ is used to indicate a complex type name. Each complex type vector element contains a real part and an imaginary part with the real part occupying the lower address in memory.

Vector Operations: component access

A component access can occur on the left-hand-side (lhs) or right-hand-side (rhs) of an assignment operator. If specified on the lhs of an assignment, each component must be uniquely identifiable.

The C7x programming model implementation supports OpenCL C like swizzle operators:

Vector Operations: concatenation

Scalar entities or shorter vectors can be concatenated together to form longer vectors. When all of the components involved are constants, the result is a vector literal. Otherwise, the vector’s value is determined at run-time.

Vector Operations: conversion and re-interpretation

The C7x programming model includes functions that can convert or re-interpret the elements of one vector type as another vector type.

Neither the convert_() nor the as_() is available for use with complex types.

Vector Operations: infix operators

When infix operators are applied to vector type objects, the operator is applied element by element. That is, each element in the result vector is the result of applying the infix operator to the corresponding elements in the source vector(s).

Vector Operations: built-in functions

Prototypes for all of the vector built-in functions supported in the C7x programming model are listed in the “c7x.h” header file that you can find in the “include” sub-directory where your C7000 CGT package was installed. Please refer to the contents of “c7x.h” for a complete list of the vector built-in functions.

Here is an example which uses vector built-in functions:

  [vbif_ex.c]

    #include <stdio.h>
    #include <c7x.h>

    void print_short4(char *s, short4 v)
    {
       printf("%s", s);
       printf(" <%d, %d, %d, %d>\n", v.x, v.y, v.z, v.w);
    }

    int main()
    {
       short4 va = (short4) (1, 2, 3, -32766);
       short4 vb = (short4) (5, 32767, -13, 17);
       short4 vc = va + vb;
       short4 vd = va - vb;
       short4 ve = __add_sat(va, vb);
       short4 vf = __sub_sat(va, vb);
       print_short4("va=", va);
       print_short4("vb=", vb);
       print_short4("vc=(va+vb)=", vc);
       print_short4("vd=(va-vb)=", vd);
       print_short4("ve=__add_sat(va,vb)=", ve);
       print_short4("vf=__sub_sat(va,vb)=", vf);
       return 0;
    }

Compile:

    %> cl7x -mv7100 -o1 -k vbif_ex.c -z -o vbif_ex.out -llnk.cmd

Note:

Run:

Load and run vbif_ex.out from the C7000 simulator to get the following result:

    va= <1, 2, 3, -32766>
    vb= <5, 32767, -13, 17>
    vc=(va+vb)= <6, -32767, -10, -32749>
    vd=(va-vb)= <-4, -32765, 16, 32753>
    ve=__add_sat(va,vb)= <6, 32767, -10, -32749>
    vf=__sub_sat(va,vb)= <-4, -32765, 16, -32768>

8 Removal of MISRA 2004 compiler command-line options


The C7000 C/C++ Compiler does not support MISRA 2004 checking as some other Texas Instruments compilers do. Therefore, the command-line options for MISRA 2004 checking have been removed and are no longer accepted by the compiler.


9 Silicon errata i2117 workaround support


The compiler option “–silicon_errata_i2117” has been added to generate code that automatically works around silicon errata i2117. MMA performance may be negatively impacted by the use of this option in edge cases.


10 Resolved defects


Resolved defects in v1.3.0:

ID Summary
CODEGEN-6810 Parser failure with nested lambdas
CODEGEN-6453 Conditional register allocated to B side causes failure in software pipelining

11 Known defects

Known defects in v1.3.0:

ID Summary
CODEGEN-6995 __builtin_expect not supported yet on C7000 Compiler: Compiler fails with INTERNAL ERROR: no match for ICALL
CODEGEN-6705 Customer SA0ADV code crashes parser
CODEGEN-6699 CCS shows wrong C7x assembly decoding of instruction machine code
CODEGEN-6509 Compiler error: no instance of function template matches the argument list

End Of File