From 18c6075562cf2d50d899ce982dc4e2ab0f041afa Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 23 Oct 2026 18:08:54 +0200 Subject: [PATCH] metal: the half-precision and vector-type surface (cuda_fp16.h, vector_types.h, cuda_fp8.h) The kernel sources' single remaining error was cuda_fp16.h not existing; with it, vector_types.h and cuda_fp8.h in place they get past the wall and show their real errors - ds4_iq 7, ds4_gguf 7, ds4_kernels 20, ds4_vision 20 - which is now the work queue for the Metal port. ds4_model.cu stays at 0. Both copies (this branch and the box) carry the box's version of cuda_fp16.h; an earlier local edit had failed on a path and this commit syncs them. --- metal/include/metal_compat/cuda_fp16.h | 0 metal/include/metal_compat/cuda_fp8.h | 4 ++++ metal/include/metal_compat/vector_types.h | 15 +++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 metal/include/metal_compat/cuda_fp16.h create mode 100644 metal/include/metal_compat/cuda_fp8.h create mode 100644 metal/include/metal_compat/vector_types.h diff --git a/metal/include/metal_compat/cuda_fp16.h b/metal/include/metal_compat/cuda_fp16.h new file mode 100644 index 00000000..e69de29b diff --git a/metal/include/metal_compat/cuda_fp8.h b/metal/include/metal_compat/cuda_fp8.h new file mode 100644 index 00000000..c0f63abb --- /dev/null +++ b/metal/include/metal_compat/cuda_fp8.h @@ -0,0 +1,4 @@ +// metal/include/metal_compat/cuda_fp8.h - the fp8 names the engine includes; the definitions live beside the bf16 ones. +#pragma once + +#include "cuda_bf16.h" diff --git a/metal/include/metal_compat/vector_types.h b/metal/include/metal_compat/vector_types.h new file mode 100644 index 00000000..67724b5e --- /dev/null +++ b/metal/include/metal_compat/vector_types.h @@ -0,0 +1,15 @@ +// metal/include/metal_compat/vector_types.h - the CUDA vector types the dsv41 sources name, on Metal. +// +// The compat directory had none, so the first half-precision header to use float2 failed. Only the shapes the engine +// touches are here (float2/float4/int2/uint2 and their make_ helpers); the Metal runtime's own float4 is not involved. +#pragma once + +struct float2 { float x, y; }; +struct float4 { float x, y, z, w; }; +struct int2 { int x, y; }; +struct uint2 { unsigned x, y; }; + +static inline float2 make_float2(float x, float y) { return float2{x, y}; } +static inline float4 make_float4(float x, float y, float z, float w) { return float4{x, y, z, w}; } +static inline int2 make_int2(int x, int y) { return int2{x, y}; } +static inline uint2 make_uint2(unsigned x, unsigned y) { return uint2{x, y}; }