Skip to content

[SM6.10] Convert needs an overload that takes an InterpretedVector #8418

@hekota

Description

@hekota

Convert currently does not support packed type vector sizes that are not a multiple of the number of elements per scalar.

For example, if we have packed vector with component type F8_E4M3FN and size 7, it gets loaded to into vector<uint, 2>. When we want to convert it to vector<half, 7>, the Convert function does not support that because it returns vector<half, 8>. It has no way of knowing that the vector<uint, 2> actually contains 7 valid packed element and not 8.

VectorRef<ComponentType::F8_E4M3FN, 7> vecRef = {Buf, 0};
vector<uint, 2> vecPacked = BiasRef.Buf.Load<vector<uint,2>(0);
vector<half, 7> vecConverted = Convert<ComponentType::F16, ComponentType::F8_E4M3FN>(vecPacked);

error: cannot initialize a variable of type 'vector<half, 7>' with an rvalue of type 'vector<half, 8>'

We should add a Convert function that takes an InterpretedVector that would carry the packed element count into Convert and enable returning of the correct vector type.

Once this is fixed, update MultiplyAdd implementations in the linalg.h header that take a VectorRef to use this new overload.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions