- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
[RISCV] 'Zalrsc' may permit non-base instructions #165042
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
Changes from 1 commit
07af5e4
              21a358e
              84c01c1
              c656689
              603eec4
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -1906,6 +1906,22 @@ def FeatureForcedAtomics : SubtargetFeature< | |
| def HasAtomicLdSt | ||
| : Predicate<"Subtarget->hasStdExtZalrsc() || Subtarget->hasForcedAtomics()">; | ||
|  | ||
| // The RISCV Unprivileged Architecture defines _constrained_ LR/SC loops: | ||
|          | ||
| // The dynamic code executed between the LR and SC instructions can only | ||
| // contain instructions from the base ''I'' instruction set, excluding loads, | ||
| // stores, backward jumps, taken backward branches, JALR, FENCE, and SYSTEM | ||
| // instructions. Compressed forms of the aforementioned ''I'' instructions in | ||
| // the Zca and Zcb extensions are also permitted. | ||
| // LR/SC loops that do not adhere to the above are _unconstrained_ LR/SC loops, | ||
| // and success is implementation specific. For implementations which know that | ||
| // non-base instructions (such as the ''B'' extension) will not violate any | ||
| // forward progress guarantees, using these instructions to reduce the LR/SC | ||
| // sequence length is desirable. | ||
| def FeaturePermissiveZalrsc | ||
| : SubtargetFeature< | ||
| "permissive-zalrsc", "HasPermissiveZalrsc", "true", | ||
| "Implementation permits non-base instructions between LR/SC pairs">; | ||
|         
                  fpetrogalli marked this conversation as resolved.
              Show resolved
            Hide resolved 
      Comment on lines
    
      +1923
     to 
      +1926
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can I ask about the general trajectory here: Do we expect all "permissive" cores to support the same set of instructions in zalrsc, or might different cores allow different sets of extensions in their loops? If we expect different cores to allow different extensions, we should not be using such a generic name - I would prefer something like  I would be slightly concerned if we're going to have a massive spread of these features (as for SFB). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Certainly a reasonable ask. This feature is from the point of view of a minimal RISC-V core with LR/SC, and a global monitor that is external to the core. In such a configuration the global monitor is aware only of the load/store transactions to the memory system, and completely unaware of what instructions or control flow occurred on the CPU(s) (or non-CPU devices) to generate those transactions. Any instruction mix is permissible in this style of system (ignoring higher order concerns of guaranteed forward progress / eventual success), as long as the same memory transactions present to the monitor. It is necessary to have some  This avoids the explosion in features to cover the cross-products of permitted Zalrsc x {XYZ, ABC, etc}. If a core has no constraints on what is permitted, and it also has an instruction extension that gives a shorter sequence go ahead and use it. Realistically though there is a tiny vocabulary of  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great, thanks for explaining. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment does not mention the "16 instructions placed sequentially in memory" rule that is also applied on constrained LR/SC sequences. Is it considered to be relaxed here? LR/SC sequences succeed on Rocket if the SC comes after the LR within a fixed window measured in cycles and there are no intervening memory operations. Importantly, all of the instructions allowed in a constrained LR/SC loop are single-cycle on Rocket; min/max would extremely likely be fine, but div is problematic, mul might be depending on configuration, and floating point may work if there is real hardware support, but definitely won't if it is emulated by privileged software (which is allowed even if F/D are in -march). | ||
|  | ||
| def FeatureTaggedGlobals : SubtargetFeature<"tagged-globals", | ||
| "AllowTaggedGlobals", | ||
| "true", "Use an instruction sequence for taking the address of a global " | ||
|  | ||
Uh oh!
There was an error while loading. Please reload this page.