abi-aa icon indicating copy to clipboard operation
abi-aa copied to clipboard

Add alpha-level support for SME

Open rsandifo-arm opened this issue 2 years ago • 2 comments

This patch adds support for SME (Scalable Matrix Extension). At this stage it is still alpha quality.

The request also includes https://github.com/ARM-software/abi-aa/pull/122

rsandifo-arm avatar Dec 17 '21 17:12 rsandifo-arm

@paulwalker-arm pointed out that the __arm_tpidr2_save spec was contradictory: it said that the function must clear TPIDR2_EL0 after saving ZA, but it also said that the function left ZA dormant.

It would have been possible to fix that by saying that the function leaves ZA active if ZA was previously dormant. This would make the function's interface incompatible with both the private-ZA and shared-ZA specs. However, it didn't seem worth adding a third type of ZA interface for this one function.

The new version therefore makes it the caller's responsibility to clear TPIDR2_EL0 instead. __arm_tpidr2_save is then a normal private-ZA function.

rsandifo-arm avatar Jun 16 '22 09:06 rsandifo-arm

I've updated the definition of streaming-compatible function interfaces so that they no longer have the extra PSTATE argument. There is instead a new __arm_sme_state that returns whether the function has access to SME and (if so) what the current values of TPIDR2_EL0, PSTATE.SM and PSTATE.ZA are.

The man advantage of this is that an object file could define a streaming-compatible function symbol to be an alias of a non-streaming function symbol, if the non-streaming function is known to be naturally streaming-compatible. The main disadvantage is that it's now more expensive to read PSTATE.SM in a “safe” way (that is, in a way that works even on non-SME targets). However, it seems relatively unlikely that performance-critical paths of a streaming-compatible function would call (say) a non-streaming function; such a function should probably not be streaming-compatible.

rsandifo-arm avatar Jul 01 '22 07:07 rsandifo-arm