This is an archive of the discontinued LLVM Phabricator instance.

[lldb][AArch64] Add tests for SME's SVE register state to TestArm64DynamicRegsets
ClosedPublic

Authored by DavidSpickett on Aug 14 2023, 2:22 AM.

Details

Summary

SME reuses SVE's register state but adds new modes to it. Therefore
we can't check all those in the same test as the existing SVE
checks.

SME's ZA, SVG and SVCR register checks will be added to this test
in later patches.

Prior to this we didn't have any testing of writing streaming mode
SVE registers from lldb, only writing SVE registers in normal
(non-streaming) SVE mode.

Diff Detail

Event Timeline

DavidSpickett created this revision.Aug 14 2023, 2:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2023, 2:22 AM
DavidSpickett requested review of this revision.Aug 14 2023, 2:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2023, 2:22 AM
Matt added a subscriber: Matt.Aug 14 2023, 2:40 PM

Can you add more description to this patch. at the moment reading it without SME context in mind does not provide enough information to figure out what we are doing.

DavidSpickett retitled this revision from [lldb][AArch64] Add SME's SVE register state to TestArm64DynamicRegsets to [lldb][AArch64] Add SME's tests for SVE register state to TestArm64DynamicRegsets.Sep 12 2023, 3:20 AM
DavidSpickett edited the summary of this revision. (Show Details)

Did my best to update the commit message.

In this test can we figure out whether SVE was read from Streaming mode or normal SVE mode?? and if yes may be add a check for that.

lldb/test/API/commands/register/register/aarch64_dynamic_regset/TestArm64DynamicRegsets.py
156

can we use self.thread().GetSelectedFrame().GetRegisters() ?? or are you going to use target process thread and current frame variables in later patches?

In this test can we figure out whether SVE was read from Streaming mode or normal SVE mode?? and if yes may be add a check for that.

Not sure what you mean.

If you mean:

  • write non-streaming SVE with one set of values
  • write streaming SVE with another
  • assert that lldb read the correct one

There are a couple of issues there:

  • If lldb read the inactive mode, it would fail with unavailable register due to a failure down in lldb-sever. These tests would already catch that.
  • The kernel and the architecture say that the values of the registers for the mode you are coming from are wiped out on mode switch. So we wouldn't be able to truly read those values even if we were able to make the ptrace call and get some data.

So it's covered, but does not/ can not be covered by checking values. It'll be correct values, or a complete failure to read.

lldb/test/API/commands/register/register/aarch64_dynamic_regset/TestArm64DynamicRegsets.py
156

No I just copied this from the original test, in fact later I wrap this all into a function.

Use the simpler way to get the register sets.

DavidSpickett marked an inline comment as done.Sep 12 2023, 5:45 AM

In this test can we figure out whether SVE was read from Streaming mode or normal SVE mode?? and if yes may be add a check for that.

Not sure what you mean.

If you mean:

  • write non-streaming SVE with one set of values
  • write streaming SVE with another
  • assert that lldb read the correct one

There are a couple of issues there:

  • If lldb read the inactive mode, it would fail with unavailable register due to a failure down in lldb-sever. These tests would already catch that.
  • The kernel and the architecture say that the values of the registers for the mode you are coming from are wiped out on mode switch. So we wouldn't be able to truly read those values even if we were able to make the ptrace call and get some data.

So it's covered, but does not/ can not be covered by checking values. It'll be correct values, or a complete failure to read.

Thanks for the detailed clarification.

I was actually curious if LLDB user can distinguish whether we are reading SVE registers from streaming mode or normal SVE mode. But yes only config registers like vg can tell that registers are read in non-SVE(FPSIMD), normal SVE, or streaming modes.

omjavaid accepted this revision.Sep 13 2023, 12:43 AM
This revision is now accepted and ready to land.Sep 13 2023, 12:43 AM

I was actually curious if LLDB user can distinguish whether we are reading SVE registers from streaming mode or normal SVE mode. But yes only config registers like vg can tell that registers are read in non-SVE(FPSIMD), normal SVE, or streaming modes.

Right, good point and yes they can but not until https://reviews.llvm.org/D154927. In that I also update the tests to check that svcr has the correct value for the expected mode the test is running in.

They'll be able to check SVCR.SM (bit 0) to know if they are in streaming mode (which will eventually be nicely printed M = 1 but that's unrelated to this series).

They can also see if SVG and VG match, but vector lengths can overlap so this won't always work, so SVCR is the official way to do it.

DavidSpickett retitled this revision from [lldb][AArch64] Add SME's tests for SVE register state to TestArm64DynamicRegsets to [lldb][AArch64] Add tests for SME's SVE register state to TestArm64DynamicRegsets.Sep 13 2023, 2:06 AM