Skip to content
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

clarify semantics of masked.load/store #77449

Closed
wants to merge 1 commit into from

Conversation

RalfJung
Copy link
Contributor

@RalfJung RalfJung commented Jan 9, 2024

Talking about exceptions ignores IR-level concerns such as out-of-bounds accesses being UB even when they are guaranteed to not raise an exception. So clarify the semantics of masked.load and masked.store by focusing on IR-level semantics.

@llvmbot llvmbot added the llvm:ir label Jan 9, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 9, 2024

@llvm/pr-subscribers-llvm-ir

Author: Ralf Jung (RalfJung)

Changes

Talking about exceptions ignores IR-level concerns such as out-of-bounds accesses being UB even when they are guaranteed to not raise an exception. So clarify the semantics of masked.load and masked.store by focusing on IR-level semantics.


Full diff: https://github.com/llvm/llvm-project/pull/77449.diff

1 Files Affected:

  • (modified) llvm/docs/LangRef.rst (+4-2)
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index b5918e3063d868..7dd88c7b91da9e 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -23611,7 +23611,8 @@ Semantics:
 """"""""""
 
 The '``llvm.masked.load``' intrinsic is designed for conditional reading of selected vector elements in a single IR operation. It is useful for targets that support vector masked loads and allows vectorizing predicated basic blocks on these targets. Other targets may support this intrinsic differently, for example by lowering it into a sequence of branches that guard scalar load operations.
-The result of this operation is equivalent to a regular vector load instruction followed by a 'select' between the loaded and the passthru values, predicated on the same mask. However, using this intrinsic prevents exceptions on memory access to masked-off lanes.
+The result of this operation is equivalent to a regular vector load instruction followed by a 'select' between the loaded and the passthru values, predicated on the same mask.
+However, masked-off lanes may be out-of-bounds and they are not considered accessed for the purpose of data races or `noalias` constraints.
 
 
 ::
@@ -23653,7 +23654,8 @@ Semantics:
 """"""""""
 
 The '``llvm.masked.store``' intrinsics is designed for conditional writing of selected vector elements in a single IR operation. It is useful for targets that support vector masked store and allows vectorizing predicated basic blocks on these targets. Other targets may support this intrinsic differently, for example by lowering it into a sequence of branches that guard scalar store operations.
-The result of this operation is equivalent to a load-modify-store sequence. However, using this intrinsic prevents exceptions and data races on memory access to masked-off lanes.
+The result of this operation is equivalent to a load-modify-store sequence.
+However, masked-off lanes may be out-of-bounds and they are not considered accessed for the purpose of data races or `noalias` constraints.
 
 ::
 

@RalfJung
Copy link
Contributor Author

ping

Not sure whom else to add as reviewer here.

@RalfJung
Copy link
Contributor Author

RalfJung commented May 2, 2024

Superseded by #82469.

@RalfJung RalfJung closed this May 2, 2024
@RalfJung RalfJung deleted the langref-masked branch May 2, 2024 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants