Skip to content

C++: Add Arm scalable vector type QL classes #19792

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

Merged
merged 4 commits into from
Jun 18, 2025
Merged

C++: Add Arm scalable vector type QL classes #19792

merged 4 commits into from
Jun 18, 2025

Conversation

jketema
Copy link
Contributor

@jketema jketema commented Jun 17, 2025

Update the database scheme to support Arm scalable vector extensions. Also introduce relevant QL classes for the scalable vector type.

I would like to omit a change note here, as users cannot extract these types at the moment. It seems more appropriate to write a single change note once that is possible.

@github-actions github-actions bot added the C++ label Jun 17, 2025
@jketema jketema force-pushed the sve branch 4 times, most recently from 7f9dd16 to 850779c Compare June 17, 2025 13:10
@jketema jketema added the no-change-note-required This PR does not need a change note label Jun 17, 2025
@jketema jketema force-pushed the sve branch 2 times, most recently from 8cd78be to f579099 Compare June 18, 2025 10:11
@jketema jketema marked this pull request as ready for review June 18, 2025 12:19
@Copilot Copilot AI review requested due to automatic review settings June 18, 2025 12:19
@jketema jketema requested a review from a team as a code owner June 18, 2025 12:19
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for Arm scalable vector extensions by extending the database schema, introducing new QL classes, and updating tests to recognize the new types.

  • Define new built-in type kind for __SVCount_t and derived type kind for scalable vectors
  • Add tupleelements table and implement ScalableVectorCount/ScalableVectorType in QL
  • Update library-tests to include __SVCount_t in various expected outputs

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cpp/ql/test/library-tests/variables/variables/types.expected Add expected entry for __SVCount_t as ScalableVectorCount
cpp/ql/test/library-tests/unspecified_type/types/unspecified_type.expected Include __SVCount_t in unspecified-type tests
cpp/ql/test/library-tests/type_sizes/type_sizes.expected Record size (0) for __SVCount_t
cpp/ql/test/library-tests/templates/type_instantiations/types.expected Add __SVCount_t to template instantiation tests
cpp/ql/lib/upgrades/9baef67d1ffc1551429dbe1c1130815693e28218/upgrade.properties Declare Arm scalable vector support upgrade
cpp/ql/lib/semmlecode.cpp.dbscheme Introduce kinds @scalable_vector_count (63) and @scalable_vector (11)
cpp/ql/lib/semmle/code/cpp/ir/internal/CppType.qll Treat ScalableVectorCount as opaque in size queries
cpp/ql/lib/semmle/code/cpp/Type.qll Add ScalableVectorCount and ScalableVectorType classes; exclude count type from arithmetic
cpp/downgrades/e38346051783182ea75822e4adf8d4c6a949bc37/upgrade.properties Define downgrade for scalable vector support
cpp/downgrades/e38346051783182ea75822e4adf8d4c6a949bc37/derivedtypes.ql Map scalable vector kind back to GNU vector on downgrade
cpp/downgrades/e38346051783182ea75822e4adf8d4c6a949bc37/builtintypes.ql Map __SVCount_t kind to error on downgrade

@@ -134,6 +134,8 @@ private predicate isOpaqueType(Type type) {
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, but shouldn't we treat ScalableVectorType similarly to , e.g., GNUVectorType?

Suggested change
)
type instanceof ScalableVectorType
)

Copy link
Contributor Author

@jketema jketema Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably. Writing IR tests is on the to-do list as a follow-up. The below was just need to make sure the tests don't fall over, because ScalableVectorCount has no size. So fixing or adapting this I would like to postpone once I have some time to write some tests.

Copy link
Contributor

@IdrissRio IdrissRio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jketema jketema merged commit 2e5d52e into github:main Jun 18, 2025
15 of 16 checks passed
@jketema jketema deleted the sve branch June 18, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants