This is an archive of the discontinued LLVM Phabricator instance.

[mlir][llvm] Fix conversion of scalable vectors of rank > 1
AbandonedPublic

Authored by c-rhodes on Jun 27 2023, 9:57 AM.

Details

Summary

Vector types of rank > 1 are converted to array(s) of vector type(s).
Arrays in LLVM cannot contain scalable vectors since the size is unknown
at compile-time, but it's currently trying to do so and creating 1-D
vector types where the number of scalable dims is greater than the rank,
triggering an assert in llvm-project/llvm/include/llvm/ADT/ArrayRef.h:255:

Assertion `Index < Length && "Invalid index!"' failed.

This patch fixes this so there's only a single scalable dim. This needs
fixing properly by adding support for converting scalable vectors of
rank > 1 to LLVM but at least now it will fail expectedly during
conversion to LLVM with:

Assertion `isValidElementType(ElementType) && "Invalid type for array
element!"' failed.

rather than with a cryptic assert.

Diff Detail

Event Timeline

c-rhodes created this revision.Jun 27 2023, 9:57 AM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
c-rhodes requested review of this revision.Jun 27 2023, 9:57 AM
c-rhodes abandoned this revision.Jun 28 2023, 2:34 AM

D153412 fixes this by removing numScalableDims.