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

ir: thread vscale range from State to Type #1139

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

Conversation

artagnon
Copy link
Contributor

@artagnon artagnon commented Dec 9, 2024

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.

-- 8< --
Based on #1121.

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.
if (auto agg = ty.getAsAggregateType()) {
// non-pointer vectors are stored/loaded all at once
if (agg->isVectorType()) {
auto &elemTy = agg->getChild(0);
if (!elemTy.isPtrType())
return divide_up(agg->numElementsConst() * elemTy.bits(), 8);
return divide_up(
agg->numElementsConst(vscaleRange) * elemTy.bits(vscaleRange), 8);

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