Skip to content

Commit 589ab9c

Browse files
committed
cont : simplify - no need to use GPU address
ggml-ci
1 parent 7dc9199 commit 589ab9c

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

ggml/src/ggml-metal/ggml-metal.m

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,13 +2120,9 @@ static bool ggml_metal_encode_mem_ranges_add_src(struct ggml_metal_encode_contex
21202120
return true;
21212121
}
21222122

2123-
size_t offs = 0;
2124-
id<MTLBuffer> id_node = ggml_metal_get_buffer(node, &offs);
2125-
GGML_ASSERT(id_node != nil);
2126-
21272123
struct mem_range r = {
2128-
/*.p0 =*/ id_node.gpuAddress + offs,
2129-
/*.p1 =*/ id_node.gpuAddress + offs + ggml_nbytes(node),
2124+
/*.p0 =*/ (uint64_t) node->data,
2125+
/*.p1 =*/ (uint64_t) node->data + ggml_nbytes(node),
21302126
/*.pt =*/ 0,
21312127
};
21322128

@@ -2140,13 +2136,9 @@ static bool ggml_metal_encode_mem_ranges_add_src(struct ggml_metal_encode_contex
21402136
static bool ggml_metal_encode_mem_ranges_add_dst(struct ggml_metal_encode_context * ctx, const struct ggml_tensor * node) {
21412137
GGML_ASSERT(node);
21422138

2143-
size_t offs = 0;
2144-
id<MTLBuffer> id_node = ggml_metal_get_buffer(node, &offs);
2145-
GGML_ASSERT(id_node != nil);
2146-
21472139
struct mem_range r = {
2148-
/*.p0 =*/ id_node.gpuAddress + offs,
2149-
/*.p1 =*/ id_node.gpuAddress + offs + ggml_nbytes(node),
2140+
/*.p0 =*/ (uint64_t) node->data,
2141+
/*.p1 =*/ (uint64_t) node->data + ggml_nbytes(node),
21502142
/*.pt =*/ 1,
21512143
};
21522144

@@ -2179,13 +2171,9 @@ static bool ggml_metal_encode_mem_ranges_check_src(const struct ggml_metal_encod
21792171
return false;
21802172
}
21812173

2182-
size_t offs = 0;
2183-
id<MTLBuffer> id_node = ggml_metal_get_buffer(node, &offs);
2184-
GGML_ASSERT(id_node != nil);
2185-
21862174
struct mem_range r = {
2187-
/*.p0 =*/ id_node.gpuAddress + offs,
2188-
/*.p1 =*/ id_node.gpuAddress + offs + ggml_nbytes(node),
2175+
/*.p0 =*/ (uint64_t) node->data,
2176+
/*.p1 =*/ (uint64_t) node->data + ggml_nbytes(node),
21892177
/*.pt =*/ 0,
21902178
};
21912179

@@ -2203,13 +2191,9 @@ static bool ggml_metal_encode_mem_ranges_check_src(const struct ggml_metal_encod
22032191
static bool ggml_metal_encode_mem_ranges_check_dst(const struct ggml_metal_encode_context * ctx, const struct ggml_tensor * node) {
22042192
GGML_ASSERT(node);
22052193

2206-
size_t offs = 0;
2207-
id<MTLBuffer> id_node = ggml_metal_get_buffer(node, &offs);
2208-
GGML_ASSERT(id_node != nil);
2209-
22102194
struct mem_range r = {
2211-
/*.p0 =*/ id_node.gpuAddress + offs,
2212-
/*.p1 =*/ id_node.gpuAddress + offs + ggml_nbytes(node),
2195+
/*.p0 =*/ (uint64_t) node->data,
2196+
/*.p1 =*/ (uint64_t) node->data + ggml_nbytes(node),
22132197
/*.pt =*/ 1,
22142198
};
22152199

0 commit comments

Comments
 (0)