-
Notifications
You must be signed in to change notification settings - Fork 127
[NeoML] Remove excess CUDA syncs in layers #1070
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
Open
favorart
wants to merge
26
commits into
neoml-lib:master
Choose a base branch
from
favorart:golikovCudaSynks
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or 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
348b510
to
5a0a420
Compare
5a0a420
to
b4a4d87
Compare
10a5d73
to
45e7272
Compare
45e7272
to
29e6080
Compare
0243fef
to
d6a59b3
Compare
c034568
to
a5b3b57
Compare
9003d6c
to
8f9b250
Compare
8f9b250
to
e0e255b
Compare
e0e255b
to
8eb3272
Compare
favorart
added a commit
to favorart/neoml
that referenced
this pull request
Aug 29, 2024
Signed-off-by: Kirill Golikov <[email protected]>
8eb3272
to
fc60504
Compare
favorart
added a commit
to favorart/neoml
that referenced
this pull request
Sep 2, 2024
Signed-off-by: Kirill Golikov <[email protected]>
a095afb
to
ff8788f
Compare
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
ff8788f
to
41e9ca4
Compare
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
41e9ca4
to
c2fd9cc
Compare
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.
Please, merge before:
The idea behind eliminating unnecessary synchronizations for CUDA is that scalar constants can be passed to GPU computation kernels from host memory by value.
It would be possible to replace arguments that imply scalar constants in math engine methods with
float
orint
types. But then, if such operations would use the result of a previous operation (for example, you often need to multiply by the result of a scalar product), you would have to add additional synchronization to obtain the result from the device memory to the host memory.To exclude both synchronization options, the wrapper class
CScalarPararmeter<T>
is used, which contains both a scalar constant and a handler-pointer to the device’s memory as fields. The value of a scalar parameter can lie in the only its field (but not both at the same time), depending on which constructor was called initially.CScalarPararmeter<T>
is instantiated by two types:float
andint
.All constructors of the
CScalarPararmeter<T>
wrapper areimplicit
. Therefore, it can easily be constructed itself, both from the value of a scalar constant in the host memory, and from a handler-pointer to the device’s memory. This design will allow you to avoid compilation errors while merging to the OCRT.To eliminate unnecessary synchronizations for CUDA and in the OCRT module, you will have to manually transfer scalar constants that were previously constructed using any
CTypedHandleStackVar<T>
directly to the method of the mathematical engine in all places where scalar constants are used, which is more natural and readable.