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.
Convertcurrently 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_E4M3FNand size7, it gets loaded to intovector<uint, 2>. When we want to convert it tovector<half, 7>, theConvertfunction does not support that because it returnsvector<half, 8>. It has no way of knowing that thevector<uint, 2>actually contains7valid packed element and not8.We should add a
Convertfunction that takes anInterpretedVectorthat would carry the packed element count intoConvertand enable returning of the correct vector type.Once this is fixed, update
MultiplyAddimplementations in thelinalg.hheader that take aVectorRefto use this new overload.