-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add LoongArch v1.10 docs #12
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wangliu-iscas
pushed a commit
to plctlab/patchwork-gcc
that referenced
this pull request
Nov 14, 2023
LA664 defines DBAR hints 0x1 - 0x1f (except 0xf and 0x1f) as follows [1-2]: - Bit 4: kind of constraint (0: completion, 1: ordering) - Bit 3: barrier for previous read (0: true, 1: false) - Bit 2: barrier for previous write (0: true, 1: false) - Bit 1: barrier for succeeding read (0: true, 1: false) - Bit 0: barrier for succeeding write (0: true, 1: false) LLVM has already utilized them for different memory orders [3]: - Bit 4 is always set to one because it's only intended to be zero for things like MMIO devices, which are out of the scope of memory orders. - An acquire barrier is used to implement acquire loads like ld.d $a1, $t0, 0 dbar acquire_hint where the load operation (ld.d) should not be reordered with any load or store operation after the acquire load. To accomplish this constraint, we need to prevent the load operation from being reordered after the barrier, and also prevent any following load/store operation from being reordered before the barrier. Thus bits 0, 1, and 3 must be zero, and bit 2 can be one, so acquire_hint should be 0b10100. - An release barrier is used to implement release stores like dbar release_hint st.d $a1, $t0, 0 where the store operation (st.d) should not be reordered with any load or store operation before the release store. So we need to prevent the store operation from being reordered before the barrier, and also prevent any preceding load/store operation from being reordered after the barrier. So bits 0, 2, 3 must be zero, and bit 1 can be one. So release_hint should be 0b10010. A similar mapping has been utilized for RISC-V GCC [4], LoongArch Linux kernel [1], and LoongArch LLVM [3]. So the mapping should be correct. And I've also bootstrapped & regtested GCC on a LA664 with this patch. The LoongArch CPUs should treat "unknown" hints as dbar 0, so we can unconditionally emit the new hints without a compiler switch. [1]: https://git.kernel.org/torvalds/c/e031a5f3f1ed [2]: loongson-community/docs#12 [3]: llvm/llvm-project#68787 [4]: https://gcc.gnu.org/r14-406 gcc/ChangeLog: * config/loongarch/sync.md (mem_thread_fence): Remove redundant check. (mem_thread_fence_1): Emit finer-grained DBAR hints for different memory models, instead of 0.
nstester
pushed a commit
to nstester/gcc
that referenced
this pull request
Nov 14, 2023
LA664 defines DBAR hints 0x1 - 0x1f (except 0xf and 0x1f) as follows [1-2]: - Bit 4: kind of constraint (0: completion, 1: ordering) - Bit 3: barrier for previous read (0: true, 1: false) - Bit 2: barrier for previous write (0: true, 1: false) - Bit 1: barrier for succeeding read (0: true, 1: false) - Bit 0: barrier for succeeding write (0: true, 1: false) LLVM has already utilized them for different memory orders [3]: - Bit 4 is always set to one because it's only intended to be zero for things like MMIO devices, which are out of the scope of memory orders. - An acquire barrier is used to implement acquire loads like ld.d $a1, $t0, 0 dbar acquire_hint where the load operation (ld.d) should not be reordered with any load or store operation after the acquire load. To accomplish this constraint, we need to prevent the load operation from being reordered after the barrier, and also prevent any following load/store operation from being reordered before the barrier. Thus bits 0, 1, and 3 must be zero, and bit 2 can be one, so acquire_hint should be 0b10100. - An release barrier is used to implement release stores like dbar release_hint st.d $a1, $t0, 0 where the store operation (st.d) should not be reordered with any load or store operation before the release store. So we need to prevent the store operation from being reordered before the barrier, and also prevent any preceding load/store operation from being reordered after the barrier. So bits 0, 2, 3 must be zero, and bit 1 can be one. So release_hint should be 0b10010. A similar mapping has been utilized for RISC-V GCC [4], LoongArch Linux kernel [1], and LoongArch LLVM [3]. So the mapping should be correct. And I've also bootstrapped & regtested GCC on a LA664 with this patch. The LoongArch CPUs should treat "unknown" hints as dbar 0, so we can unconditionally emit the new hints without a compiler switch. [1]: https://git.kernel.org/torvalds/c/e031a5f3f1ed [2]: loongson-community/docs#12 [3]: llvm/llvm-project#68787 [4]: https://gcc.gnu.org/r14-406 gcc/ChangeLog: * config/loongarch/sync.md (mem_thread_fence): Remove redundant check. (mem_thread_fence_1): Emit finer-grained DBAR hints for different memory models, instead of 0.
Blackhex
pushed a commit
to Windows-on-ARM-Experiments/gcc-woarm64
that referenced
this pull request
Dec 18, 2023
LA664 defines DBAR hints 0x1 - 0x1f (except 0xf and 0x1f) as follows [1-2]: - Bit 4: kind of constraint (0: completion, 1: ordering) - Bit 3: barrier for previous read (0: true, 1: false) - Bit 2: barrier for previous write (0: true, 1: false) - Bit 1: barrier for succeeding read (0: true, 1: false) - Bit 0: barrier for succeeding write (0: true, 1: false) LLVM has already utilized them for different memory orders [3]: - Bit 4 is always set to one because it's only intended to be zero for things like MMIO devices, which are out of the scope of memory orders. - An acquire barrier is used to implement acquire loads like ld.d $a1, $t0, 0 dbar acquire_hint where the load operation (ld.d) should not be reordered with any load or store operation after the acquire load. To accomplish this constraint, we need to prevent the load operation from being reordered after the barrier, and also prevent any following load/store operation from being reordered before the barrier. Thus bits 0, 1, and 3 must be zero, and bit 2 can be one, so acquire_hint should be 0b10100. - An release barrier is used to implement release stores like dbar release_hint st.d $a1, $t0, 0 where the store operation (st.d) should not be reordered with any load or store operation before the release store. So we need to prevent the store operation from being reordered before the barrier, and also prevent any preceding load/store operation from being reordered after the barrier. So bits 0, 2, 3 must be zero, and bit 1 can be one. So release_hint should be 0b10010. A similar mapping has been utilized for RISC-V GCC [4], LoongArch Linux kernel [1], and LoongArch LLVM [3]. So the mapping should be correct. And I've also bootstrapped & regtested GCC on a LA664 with this patch. The LoongArch CPUs should treat "unknown" hints as dbar 0, so we can unconditionally emit the new hints without a compiler switch. [1]: https://git.kernel.org/torvalds/c/e031a5f3f1ed [2]: loongson-community/docs#12 [3]: llvm/llvm-project#68787 [4]: https://gcc.gnu.org/r14-406 gcc/ChangeLog: * config/loongarch/sync.md (mem_thread_fence): Remove redundant check. (mem_thread_fence_1): Emit finer-grained DBAR hints for different memory models, instead of 0.
XYenChi
pushed a commit
to XYenChi/gcc
that referenced
this pull request
Feb 28, 2024
LA664 defines DBAR hints 0x1 - 0x1f (except 0xf and 0x1f) as follows [1-2]: - Bit 4: kind of constraint (0: completion, 1: ordering) - Bit 3: barrier for previous read (0: true, 1: false) - Bit 2: barrier for previous write (0: true, 1: false) - Bit 1: barrier for succeeding read (0: true, 1: false) - Bit 0: barrier for succeeding write (0: true, 1: false) LLVM has already utilized them for different memory orders [3]: - Bit 4 is always set to one because it's only intended to be zero for things like MMIO devices, which are out of the scope of memory orders. - An acquire barrier is used to implement acquire loads like ld.d $a1, $t0, 0 dbar acquire_hint where the load operation (ld.d) should not be reordered with any load or store operation after the acquire load. To accomplish this constraint, we need to prevent the load operation from being reordered after the barrier, and also prevent any following load/store operation from being reordered before the barrier. Thus bits 0, 1, and 3 must be zero, and bit 2 can be one, so acquire_hint should be 0b10100. - An release barrier is used to implement release stores like dbar release_hint st.d $a1, $t0, 0 where the store operation (st.d) should not be reordered with any load or store operation before the release store. So we need to prevent the store operation from being reordered before the barrier, and also prevent any preceding load/store operation from being reordered after the barrier. So bits 0, 2, 3 must be zero, and bit 1 can be one. So release_hint should be 0b10010. A similar mapping has been utilized for RISC-V GCC [4], LoongArch Linux kernel [1], and LoongArch LLVM [3]. So the mapping should be correct. And I've also bootstrapped & regtested GCC on a LA664 with this patch. The LoongArch CPUs should treat "unknown" hints as dbar 0, so we can unconditionally emit the new hints without a compiler switch. [1]: https://git.kernel.org/torvalds/c/e031a5f3f1ed [2]: loongson-community/docs#12 [3]: llvm/llvm-project#68787 [4]: https://gcc.gnu.org/r14-406 gcc/ChangeLog: * config/loongarch/sync.md (mem_thread_fence): Remove redundant check. (mem_thread_fence_1): Emit finer-grained DBAR hints for different memory models, instead of 0.
Liaoshihua
pushed a commit
to Liaoshihua/ruyi-gcc
that referenced
this pull request
Mar 13, 2024
LA664 defines DBAR hints 0x1 - 0x1f (except 0xf and 0x1f) as follows [1-2]: - Bit 4: kind of constraint (0: completion, 1: ordering) - Bit 3: barrier for previous read (0: true, 1: false) - Bit 2: barrier for previous write (0: true, 1: false) - Bit 1: barrier for succeeding read (0: true, 1: false) - Bit 0: barrier for succeeding write (0: true, 1: false) LLVM has already utilized them for different memory orders [3]: - Bit 4 is always set to one because it's only intended to be zero for things like MMIO devices, which are out of the scope of memory orders. - An acquire barrier is used to implement acquire loads like ld.d $a1, $t0, 0 dbar acquire_hint where the load operation (ld.d) should not be reordered with any load or store operation after the acquire load. To accomplish this constraint, we need to prevent the load operation from being reordered after the barrier, and also prevent any following load/store operation from being reordered before the barrier. Thus bits 0, 1, and 3 must be zero, and bit 2 can be one, so acquire_hint should be 0b10100. - An release barrier is used to implement release stores like dbar release_hint st.d $a1, $t0, 0 where the store operation (st.d) should not be reordered with any load or store operation before the release store. So we need to prevent the store operation from being reordered before the barrier, and also prevent any preceding load/store operation from being reordered after the barrier. So bits 0, 2, 3 must be zero, and bit 1 can be one. So release_hint should be 0b10010. A similar mapping has been utilized for RISC-V GCC [4], LoongArch Linux kernel [1], and LoongArch LLVM [3]. So the mapping should be correct. And I've also bootstrapped & regtested GCC on a LA664 with this patch. The LoongArch CPUs should treat "unknown" hints as dbar 0, so we can unconditionally emit the new hints without a compiler switch. [1]: https://git.kernel.org/torvalds/c/e031a5f3f1ed [2]: loongson-community/docs#12 [3]: llvm/llvm-project#68787 [4]: https://gcc.gnu.org/r14-406 gcc/ChangeLog: * config/loongarch/sync.md (mem_thread_fence): Remove redundant check. (mem_thread_fence_1): Emit finer-grained DBAR hints for different memory models, instead of 0.
XYenChi
pushed a commit
to XYenChi/gcc
that referenced
this pull request
Mar 25, 2024
LA664 defines DBAR hints 0x1 - 0x1f (except 0xf and 0x1f) as follows [1-2]: - Bit 4: kind of constraint (0: completion, 1: ordering) - Bit 3: barrier for previous read (0: true, 1: false) - Bit 2: barrier for previous write (0: true, 1: false) - Bit 1: barrier for succeeding read (0: true, 1: false) - Bit 0: barrier for succeeding write (0: true, 1: false) LLVM has already utilized them for different memory orders [3]: - Bit 4 is always set to one because it's only intended to be zero for things like MMIO devices, which are out of the scope of memory orders. - An acquire barrier is used to implement acquire loads like ld.d $a1, $t0, 0 dbar acquire_hint where the load operation (ld.d) should not be reordered with any load or store operation after the acquire load. To accomplish this constraint, we need to prevent the load operation from being reordered after the barrier, and also prevent any following load/store operation from being reordered before the barrier. Thus bits 0, 1, and 3 must be zero, and bit 2 can be one, so acquire_hint should be 0b10100. - An release barrier is used to implement release stores like dbar release_hint st.d $a1, $t0, 0 where the store operation (st.d) should not be reordered with any load or store operation before the release store. So we need to prevent the store operation from being reordered before the barrier, and also prevent any preceding load/store operation from being reordered after the barrier. So bits 0, 2, 3 must be zero, and bit 1 can be one. So release_hint should be 0b10010. A similar mapping has been utilized for RISC-V GCC [4], LoongArch Linux kernel [1], and LoongArch LLVM [3]. So the mapping should be correct. And I've also bootstrapped & regtested GCC on a LA664 with this patch. The LoongArch CPUs should treat "unknown" hints as dbar 0, so we can unconditionally emit the new hints without a compiler switch. [1]: https://git.kernel.org/torvalds/c/e031a5f3f1ed [2]: loongson-community/docs#12 [3]: llvm/llvm-project#68787 [4]: https://gcc.gnu.org/r14-406 gcc/ChangeLog: * config/loongarch/sync.md (mem_thread_fence): Remove redundant check. (mem_thread_fence_1): Emit finer-grained DBAR hints for different memory models, instead of 0.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.