This is an archive of the discontinued LLVM Phabricator instance.

[lldb][AArch64] Add SME streaming vector length pseduo register
ClosedPublic

Authored by DavidSpickett on Sep 12 2023, 4:49 AM.

Details

Summary

This adds a register "svg" which mirrors SVE's "vg" register.
This reports the streaming vector length at all times, read
from the ZA ptrace header.

This register is needed first to implement ZA resizing as
the streaming vector length changes. Like vg, svg will be
expedited to the client so it can reconfigure its register
definitions.

The other use is for users to be able to know the streaming
vector length without resorting to counting the (many, many)
bytes in ZA, or temporarily entering streaming mode (which
would be destructive).

Some refactoring has been done so we don't have to recalculate the
register offsets twice.

Testing for this will come in a later patch.

Diff Detail

Event Timeline

DavidSpickett created this revision.Sep 12 2023, 4:49 AM
DavidSpickett requested review of this revision.Sep 12 2023, 4:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2023, 4:49 AM

Why do we have svg and za in different register sets?

Made sense at the time with it being it's own regset in ptrace. Current state is:

Scalable Matrix Array Storage Registers:
        za = {<...>}

Scalable Matrix Extension Registers:
       svg = 0x0000000000000004
      svcr = 0x0000000000000003

But I agree, ZA could go in the latter group as you won't have ZA without SME.

I'll give it a go.

Adjust now that ZA is in the SME set. Putting SVG first for readability and
ease of resizing ZA later.

Why do we have svg and za in different register sets?

Done.

Scalable Matrix Extension Registers:
      svcr = 0x0000000000000000
       svg = 0x0000000000000004
        za = {0x00 <...>}

Is the layout now.

omjavaid added a comment.EditedSep 15 2023, 3:14 AM

This looks fine just couple of nits inline.

lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
354

this block of code requires clang-format run

lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
117

should we name this to sme_pseudo_regs ? sme_regs suggests struct could include ZA as well.

  • sme_regs -> sme_pseudo_regs, also changed the accesor method names.
  • clang-format
DavidSpickett marked 2 inline comments as done.Sep 15 2023, 4:13 AM

Will apply the rename in core files as well later.

Note that GetSMEOffset refers to the whole register set which does include ZA, so no change of name there.

DavidSpickett edited the summary of this revision. (Show Details)Sep 15 2023, 6:41 AM
omjavaid accepted this revision.Sep 15 2023, 7:40 AM

This is LGTM as you suggested pending child reviews.

This revision is now accepted and ready to land.Sep 15 2023, 7:40 AM