Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type: add preliminiary support for singular vscale #1140

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

artagnon
Copy link
Contributor

@artagnon artagnon commented Dec 9, 2024

Change llvm_util to correctly fill aggregates and scalable vector splats, based on the vscale_range attribute on the function, and add a virtual numElementsConst() override, to operate on the maximum value in the vscale range. Not considering all possible vscale values is obviously a correctness issue, so ensure that we only pass the type-check when the vscale range has a singular value.

In practice, the entire codebase needs to be taught about scalable vectors, before all programs with a singular vscale value are supported. The rem-costvscale.srctgt.ll test fails to type-check, for instance, due to ShuffleVector using a non-scalable mask. These instances are left as a todo for follow-up patches.

-- 8< --
Based on #1139.

In an effort to support checking of programs with scalable vectors, add
syntactic support for vscale and vscale_range, making the vscale an
smt::expr in State. For the moment, we fail to type-check any program
using scalable vectors.
Thread the vscale range information, which is an smt::expr in State to
various functions in Type, cascading down to a final numElementsConst(),
in preparation for the first step in supporting scalable vectors.
Change llvm_util to correctly fill aggregates and scalable vector
splats, based on the vscale_range attribute on the function, and add a
virtual numElementsConst() override, to operate on the maximum value in
the vscale range. Not considering all possible vscale values is
obviously a correctness issue, so ensure that we only pass the
type-check when the vscale range has a singular value.

In practice, the entire codebase needs to be taught about scalable
vectors, before all programs with a singular vscale value are supported.
The rem-costvscale.srctgt.ll test fails to type-check, for instance, due
to ShuffleVector using a non-scalable mask. These instances are left as
a todo for follow-up patches.
@artagnon artagnon changed the title Vscale singular type: add preliminiary support for singular vscale Dec 9, 2024
children.resize(elements, &elementTy);
is_padding.resize(elements, false);
unsigned scaleFactor = isScalableTy ? var_vector_max_vscale : 1;
children.resize(elements * scaleFactor, &elementTy);

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High

Multiplication result may overflow 'unsigned int' before it is converted to 'size_type'.
is_padding.resize(elements, false);
unsigned scaleFactor = isScalableTy ? var_vector_max_vscale : 1;
children.resize(elements * scaleFactor, &elementTy);
is_padding.resize(elements * scaleFactor, false);

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High

Multiplication result may overflow 'unsigned int' before it is converted to 'size_type'.
@@ -1499,24 +1551,25 @@
return 0;
}

uint64_t getCommonAccessSize(const IR::Type &ty) {
uint64_t getCommonAccessSize(const IR::Type &ty, expr vscaleRange) {

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High

Multiplication result may overflow 'unsigned int' before it is converted to 'uint64_t'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant