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
544b6739
Unverified
Commit
544b6739
authored
Nov 06, 2025
by
Daniel Hiltgen
Committed by
GitHub
Nov 06, 2025
Browse files
ggml update to b6840 (#12791)
parent
c4ba257c
Changes
103
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
3 deletions
+142
-3
ml/backend/ggml/ggml/src/ggml.c
ml/backend/ggml/ggml/src/ggml.c
+133
-1
ml/nn/rope/rope.go
ml/nn/rope/rope.go
+8
-1
model/models/qwen3vl/model_text.go
model/models/qwen3vl/model_text.go
+1
-1
No files found.
ml/backend/ggml/ggml/src/ggml.c
View file @
544b6739
...
...
@@ -1144,9 +1144,13 @@ static const char * GGML_UNARY_OP_NAME[GGML_UNARY_OP_COUNT] = {
"EXP"
,
"GELU_ERF"
,
"XIELU"
,
"FLOOR"
,
"CEIL"
,
"ROUND"
,
"TRUNC"
,
};
static_assert(GGML_UNARY_OP_COUNT ==
16
, "GGML_UNARY_OP_COUNT !=
16
");
static_assert
(
GGML_UNARY_OP_COUNT
==
20
,
"GGML_UNARY_OP_COUNT !=
20
"
);
static
const
char
*
GGML_GLU_OP_NAME
[
GGML_GLU_OP_COUNT
]
=
{
"REGLU"
,
...
...
@@ -2749,6 +2753,62 @@ static struct ggml_tensor * ggml_glu_impl(
return
result
;
}
// ggml_floor
struct
ggml_tensor
*
ggml_floor
(
struct
ggml_context
*
ctx
,
struct
ggml_tensor
*
a
)
{
return
ggml_unary
(
ctx
,
a
,
GGML_UNARY_OP_FLOOR
);
}
struct
ggml_tensor
*
ggml_floor_inplace
(
struct
ggml_context
*
ctx
,
struct
ggml_tensor
*
a
)
{
return
ggml_unary_inplace
(
ctx
,
a
,
GGML_UNARY_OP_FLOOR
);
}
// ggml_ceil
struct
ggml_tensor
*
ggml_ceil
(
struct
ggml_context
*
ctx
,
struct
ggml_tensor
*
a
)
{
return
ggml_unary
(
ctx
,
a
,
GGML_UNARY_OP_CEIL
);
}
struct
ggml_tensor
*
ggml_ceil_inplace
(
struct
ggml_context
*
ctx
,
struct
ggml_tensor
*
a
)
{
return
ggml_unary_inplace
(
ctx
,
a
,
GGML_UNARY_OP_CEIL
);
}
//ggml_round
struct
ggml_tensor
*
ggml_round
(
struct
ggml_context
*
ctx
,
struct
ggml_tensor
*
a
)
{
return
ggml_unary
(
ctx
,
a
,
GGML_UNARY_OP_ROUND
);
}
struct
ggml_tensor
*
ggml_round_inplace
(
struct
ggml_context
*
ctx
,
struct
ggml_tensor
*
a
)
{
return
ggml_unary_inplace
(
ctx
,
a
,
GGML_UNARY_OP_ROUND
);
}
//ggml_trunc
struct
ggml_tensor
*
ggml_trunc
(
struct
ggml_context
*
ctx
,
struct
ggml_tensor
*
a
)
{
return
ggml_unary
(
ctx
,
a
,
GGML_UNARY_OP_TRUNC
);
}
struct
ggml_tensor
*
ggml_trunc_inplace
(
struct
ggml_context
*
ctx
,
struct
ggml_tensor
*
a
)
{
return
ggml_unary_inplace
(
ctx
,
a
,
GGML_UNARY_OP_TRUNC
);
}
struct
ggml_tensor
*
ggml_glu
(
struct
ggml_context
*
ctx
,
struct
ggml_tensor
*
a
,
...
...
@@ -6904,6 +6964,78 @@ void ggml_graph_print(const struct ggml_cgraph * cgraph) {
GGML_LOG_INFO
(
"========================================
\n
"
);
}
static
int
ggml_node_list_find_tensor
(
const
struct
ggml_cgraph
*
cgraph
,
const
int
*
idxs
,
int
count
,
const
struct
ggml_tensor
*
tensor
)
{
GGML_ASSERT
(
cgraph
&&
idxs
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
const
int
node_idx
=
idxs
[
i
];
if
(
node_idx
>=
cgraph
->
n_nodes
)
{
return
-
1
;
}
if
(
cgraph
->
nodes
[
node_idx
]
==
tensor
)
{
return
i
;
}
}
return
-
1
;
}
bool
ggml_can_fuse_subgraph_ext
(
const
struct
ggml_cgraph
*
cgraph
,
const
int
*
node_idxs
,
int
count
,
const
enum
ggml_op
*
ops
,
const
int
*
outputs
,
int
num_outputs
)
{
GGML_ASSERT
(
outputs
&&
num_outputs
>
0
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
if
(
node_idxs
[
i
]
>=
cgraph
->
n_nodes
)
{
return
false
;
}
const
struct
ggml_tensor
*
node
=
cgraph
->
nodes
[
node_idxs
[
i
]];
if
(
node
->
op
!=
ops
[
i
])
{
return
false
;
}
if
(
ggml_node_list_find_tensor
(
cgraph
,
outputs
,
num_outputs
,
node
)
!=
-
1
)
{
continue
;
}
if
(
node
->
flags
&
GGML_TENSOR_FLAG_OUTPUT
)
{
return
false
;
}
int
subgraph_uses
=
0
;
for
(
int
j
=
i
+
1
;
j
<
count
;
++
j
)
{
const
struct
ggml_tensor
*
other_node
=
cgraph
->
nodes
[
node_idxs
[
j
]];
for
(
int
src_idx
=
0
;
src_idx
<
GGML_MAX_SRC
;
src_idx
++
)
{
if
(
other_node
->
src
[
src_idx
]
==
node
)
{
subgraph_uses
++
;
}
}
}
if
(
subgraph_uses
!=
ggml_node_get_use_count
(
cgraph
,
node_idxs
[
i
]))
{
return
false
;
}
// if node is a view, check if the view_src and all it's parent view_srcs are within the subgraph
struct
ggml_tensor
*
view_src
=
node
->
view_src
;
while
(
view_src
)
{
if
(
ggml_node_list_find_tensor
(
cgraph
,
node_idxs
,
count
,
view_src
)
==
-
1
)
{
return
false
;
}
view_src
=
view_src
->
view_src
;
}
}
return
true
;
}
// check if node is part of the graph
static
bool
ggml_graph_find
(
const
struct
ggml_cgraph
*
cgraph
,
const
struct
ggml_tensor
*
node
)
{
if
(
cgraph
==
NULL
)
{
...
...
ml/nn/rope/rope.go
View file @
544b6739
...
...
@@ -57,9 +57,16 @@ func WithAttentionFactor(attentionFactor float32) func(*Options) {
}
}
func
WithMRoPE
Sections
(
sections
[]
int
)
func
(
*
Options
)
{
func
WithMRoPE
(
sections
[]
int
)
func
(
*
Options
)
{
return
func
(
opts
*
Options
)
{
opts
.
Type
|=
1
<<
3
opts
.
MRoPE
.
Sections
=
sections
}
}
func
WithInterleaveMRoPE
(
sections
[]
int
)
func
(
*
Options
)
{
return
func
(
opts
*
Options
)
{
opts
.
Type
|=
1
<<
3
|
1
<<
5
opts
.
MRoPE
.
Sections
=
sections
}
}
model/models/qwen3vl/model_text.go
View file @
544b6739
...
...
@@ -37,7 +37,7 @@ func (o TextOptions) headDim() int {
func
(
o
TextOptions
)
applyRotaryPositionalEmbedding
(
ctx
ml
.
Context
,
t
,
p
ml
.
Tensor
)
ml
.
Tensor
{
return
fast
.
RoPE
(
ctx
,
t
,
p
,
o
.
headDim
(),
o
.
ropeBase
,
1
/
float32
(
math
.
Sqrt
(
float64
(
o
.
ropeScale
))),
rope
.
With
MRoPESections
(
o
.
mropeSections
),
rope
.
With
InterleaveMRoPE
(
o
.
mropeSections
),
)
}
...
...
Prev
1
2
3
4
5
6
Next
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