A Re-designed Range Interface

The range interface for accessing dense containers is re-designed in Intel® ArBB 1.0 Beta 3. This article summarizes new features introduced in the new range interface, as well as user code changes that are required as a result of the new interface.

  • With the new interface, dereferencing a range iterator of a container of ArBB scalar type T, now yields an uncaptured<T> instead of an ArBB scalar type T. This means range iterators read and write directly to locations in memory and do not require the use of arbb::value() to access the contents of an iterator. User code that previously uses arbb::value() needs to be modified to reflect this change.

    For instance, this code using the previous range interface:

    dense<f32> d;
    range<f32> r = d.read_write_range();
    range_iterator<f32> it;
    for(it = r.begin() ; it != r.end() ; it++) {
        printf("%f ", value(*it));
    }
    

    Will map to the following code using the new interface:

    dense<f32> d;
    range<f32> r = d.read_write_range();
    range_iterator<f32> it;
    for(it = r.begin() ; it != r.end() ; it++) {
        printf("%f ", *it);
    }
  • User-defined types are now fully supported in the new rangeinterface. To access a dense container of a user-defined type, the following must be included in the definition of the user-defined type:
    • A captured type trait,
    • An uncaptured type trait,
    • A definition of the flattened_to_structure() function for the user-defined type, and
    • A definition of the structure_to_flattened() function for the user-defined type.

Refer to this section in the Intel® ArBB User Guide to learn how to make a user-defined type to work with the new range interface: User defined types and ranges



    For more complete information about compiler optimizations, see our Optimization Notice.