diff --git a/ggml/src/ggml-metal/ggml-metal-context.m b/ggml/src/ggml-metal/ggml-metal-context.m index 5d3a8ce412ac..48b32b7cbf97 100644 --- a/ggml/src/ggml-metal/ggml-metal-context.m +++ b/ggml/src/ggml-metal/ggml-metal-context.m @@ -130,7 +130,8 @@ ggml_metal_t ggml_metal_init(ggml_metal_device_t dev) { res->d_queue = dispatch_queue_create("ggml-metal", DISPATCH_QUEUE_CONCURRENT); res->use_fusion = getenv("GGML_METAL_FUSION_DISABLE") == nil; - res->use_concurrency = getenv("GGML_METAL_CONCURRENCY_DISABLE") == nil; + // non-UMA GPUs (AMD discrete) produce incorrect results with concurrent encoders + res->use_concurrency = props_dev->has_unified_memory && getenv("GGML_METAL_CONCURRENCY_DISABLE") == nil; { const char * val = getenv("GGML_METAL_GRAPH_DEBUG"); diff --git a/ggml/src/ggml-metal/ggml-metal-device.m b/ggml/src/ggml-metal/ggml-metal-device.m index 4ea0bfb94da5..370d824765ab 100644 --- a/ggml/src/ggml-metal/ggml-metal-device.m +++ b/ggml/src/ggml-metal/ggml-metal-device.m @@ -1595,7 +1595,7 @@ void ggml_metal_buffer_memset_tensor(ggml_metal_buffer_t buf, struct ggml_tensor id encoder = [cmd_buf blitCommandEncoder]; [encoder fillBuffer:bid_dst.metal - range:NSMakeRange(bid_dst.offs, bid_dst.offs + size) + range:NSMakeRange(bid_dst.offs, size) value:value]; [encoder endEncoding];