@@ -6581,40 +6581,147 @@ Requirements on Development Tools - Engineering Specification Documentation
6581
6581
}];
6582
6582
}
6583
6583
6584
- def ArmSmeStreamingDocs : Documentation {
6585
- let Category = DocCatType;
6584
+ def DocCatArmSmeAttributes : DocumentationCategory<"AArch64 SME Attributes"> {
6586
6585
let Content = [{
6587
- .. Note:: This attribute has not been implemented yet, but once it is
6588
- implemented, it will behave as described below.
6586
+ Clang supports a number of AArch64-specific attributes to manage state
6587
+ added by the Scalable Matrix Extension (SME). This state includes the
6588
+ runtime mode that the processor is in (e.g. non-streaming or streaming)
6589
+ as well as the state of the ``ZA`` Matrix Storage.
6589
6590
6590
- The ``__arm_streaming`` keyword is only available on AArch64 targets.
6591
- It applies to function types and specifies that the function has a
6592
- "streaming interface". This means that:
6591
+ The attributes come in the form of type- and declaration attributes:
6593
6592
6594
- * the function requires the Scalable Matrix Extension (SME)
6593
+ * The SME declaration attributes can appear anywhere that a standard
6594
+ ``[[...]]`` declaration attribute can appear.
6595
6595
6596
- * the function must be entered in streaming mode (that is, with PSTATE.SM
6597
- set to 1)
6596
+ * The SME type attributes apply only to prototyped functions and can appear
6597
+ anywhere that a standard ``[[...]]`` type attribute can appear. The SME
6598
+ type attributes do not apply to functions having a K&R-style
6599
+ unprototyped function type.
6598
6600
6599
- * the function must return in streaming mode
6600
-
6601
- * the function does not have a K&R-style unprototyped function type.
6601
+ See `Arm C Language Extensions <https://github.com/ARM-software/acle>`_
6602
+ for more details about the features related to the SME extension.
6602
6603
6603
6604
See `Procedure Call Standard for the Arm® 64-bit Architecture (AArch64)
6604
6605
<https://github.com/ARM-software/abi-aa>`_ for more details about
6605
- streaming-interface functions.
6606
+ streaming-interface functions and shared/private-ZA interface functions.
6607
+ }];
6608
+ }
6609
+
6610
+ def ArmSmeStreamingDocs : Documentation {
6611
+ let Category = DocCatArmSmeAttributes;
6612
+ let Content = [{
6613
+ The ``__arm_streaming`` keyword applies to prototyped function types and specifies
6614
+ that the function has a "streaming interface". This means that:
6615
+
6616
+ * the function requires that the processor implements the Scalable Matrix
6617
+ Extension (SME).
6618
+
6619
+ * the function must be entered in streaming mode (that is, with PSTATE.SM
6620
+ set to 1)
6621
+
6622
+ * the function must return in streaming mode
6606
6623
6607
6624
Clang manages PSTATE.SM automatically; it is not the source code's
6608
- responsibility to do this. For example, if a normal non-streaming
6625
+ responsibility to do this. For example, if a non-streaming
6609
6626
function calls an ``__arm_streaming`` function, Clang generates code
6610
6627
that switches into streaming mode before calling the function and
6611
6628
switches back to non-streaming mode on return.
6629
+ }];
6630
+ }
6631
+
6632
+ def ArmSmeStreamingCompatibleDocs : Documentation {
6633
+ let Category = DocCatArmSmeAttributes;
6634
+ let Content = [{
6635
+ The ``__arm_streaming_compatible`` keyword applies to prototyped function types and
6636
+ specifies that the function has a “streaming compatible interface”. This
6637
+ means that:
6612
6638
6613
- ``__arm_streaming`` can appear anywhere that a standard ``[[...]]`` type
6614
- attribute can appear .
6639
+ * the function may be entered in either non-streaming mode (PSTATE.SM=0) or
6640
+ in streaming mode (PSTATE.SM=1) .
6615
6641
6616
- See `Arm C Language Extensions <https://github.com/ARM-software/acle>`_
6617
- for more details about this extension, and for other related SME features.
6642
+ * the function must return in the same mode as it was entered.
6643
+
6644
+ * the code executed in the function is compatible with either mode.
6645
+
6646
+ Clang manages PSTATE.SM automatically; it is not the source code's
6647
+ responsibility to do this. Clang will ensure that the generated code in
6648
+ streaming-compatible functions is valid in either mode (PSTATE.SM=0 or
6649
+ PSTATE.SM=1). For example, if an ``__arm_streaming_compatible`` function calls a
6650
+ non-streaming function, Clang generates code to temporarily switch out of streaming
6651
+ mode before calling the function and switch back to streaming-mode on return if
6652
+ ``PSTATE.SM`` is ``1`` on entry of the caller. If ``PSTATE.SM`` is ``0`` on
6653
+ entry to the ``__arm_streaming_compatible`` function, the call will be executed
6654
+ without changing modes.
6655
+ }];
6656
+ }
6657
+
6658
+ def ArmSmeSharedZADocs : Documentation {
6659
+ let Category = DocCatArmSmeAttributes;
6660
+ let Content = [{
6661
+ The ``__arm_shared_za`` keyword applies to prototyped function types and specifies
6662
+ that the function shares SME's matrix storage (ZA) with its caller. This
6663
+ means that:
6664
+
6665
+ * the function requires that the processor implements the Scalable Matrix
6666
+ Extension (SME).
6667
+
6668
+ * the function enters with ZA in an active state.
6669
+
6670
+ * the function returns with ZA in an active state.
6671
+ }];
6672
+ }
6673
+
6674
+ def ArmSmePreservesZADocs : Documentation {
6675
+ let Category = DocCatArmSmeAttributes;
6676
+ let Content = [{
6677
+ The ``__arm_preserves_za`` keyword applies to prototyped function types and
6678
+ specifies that the function does not modify ZA state.
6679
+ }];
6680
+ }
6681
+
6682
+
6683
+ def ArmSmeLocallyStreamingDocs : Documentation {
6684
+ let Category = DocCatArmSmeAttributes;
6685
+ let Content = [{
6686
+ The ``__arm_locally_streaming`` keyword applies to function declarations
6687
+ and specifies that all the statements in the function are executed in
6688
+ streaming mode. This means that:
6689
+
6690
+ * the function requires that the target processor implements the Scalable Matrix
6691
+ Extension (SME).
6692
+
6693
+ * the program automatically puts the machine into streaming mode before
6694
+ executing the statements and automatically restores the previous mode
6695
+ afterwards.
6696
+
6697
+ Clang manages PSTATE.SM automatically; it is not the source code's
6698
+ responsibility to do this. For example, Clang will emit code to enable
6699
+ streaming mode at the start of the function, and disable streaming mode
6700
+ at the end of the function.
6701
+ }];
6702
+ }
6703
+
6704
+ def ArmSmeNewZADocs : Documentation {
6705
+ let Category = DocCatArmSmeAttributes;
6706
+ let Content = [{
6707
+ The ``__arm_new_za`` keyword applies to function declarations and specifies
6708
+ that the function will be set up with a fresh ZA context.
6709
+
6710
+ This means that:
6711
+
6712
+ * the function requires that the target processor implements the Scalable Matrix
6713
+ Extension (SME).
6714
+
6715
+ * the function will commit any lazily saved ZA data.
6716
+
6717
+ * the function will create a new ZA context and enable PSTATE.ZA.
6718
+
6719
+ * the function will disable PSTATE.ZA (by setting it to 0) before returning.
6720
+
6721
+ For ``__arm_new_za`` functions Clang will set up the ZA context automatically
6722
+ on entry to the function, and disable it before returning. For example, if ZA is
6723
+ in a dormant state Clang will generate the code to commit a lazy-save and set up
6724
+ a new ZA state before executing user code.
6618
6725
}];
6619
6726
}
6620
6727
0 commit comments