Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
549c2bdf
Unverified
Commit
549c2bdf
authored
Nov 14, 2024
by
Michael Yang
Committed by
GitHub
Nov 14, 2024
Browse files
Merge pull request #7657 from ollama/mxyng/sync
fix(mllama): sync backend between batches
parents
67691e41
5b3393b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
llama/llama.go
llama/llama.go
+4
-0
llama/runner/runner.go
llama/runner/runner.go
+7
-0
No files found.
llama/llama.go
View file @
549c2bdf
...
...
@@ -600,6 +600,10 @@ func (c *Context) SetCrossAttention(state bool) {
C
.
llama_set_cross_attention
(
c
.
c
,
C
.
bool
(
state
))
}
func
(
c
*
Context
)
Synchronize
()
{
C
.
llama_synchronize
(
c
.
c
)
}
// sampling
// TODO: this is a temporary wrapper to allow calling C++ code from CGo
type
SamplingContext
struct
{
...
...
llama/runner/runner.go
View file @
549c2bdf
...
...
@@ -409,6 +409,13 @@ func (s *Server) processBatch(tokenBatch *llama.Batch, embedBatch *llama.Batch)
return
}
if
crossAttention
{
// synchronize state to ensure the cross attention batch is complete.
// needed specifically for multi-GPU systems otherwise an inflight
// task may be incorrectly invalidated causing a crash
s
.
lc
.
Synchronize
()
}
for
i
,
seq
:=
range
s
.
seqs
{
if
seq
==
nil
{
continue
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment