From 80b893f37d3e5bc73243effc287061482775fb39 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 14 Oct 2026 22:44:00 +0200 Subject: [PATCH] GPU: make std::is_pointer address-space aware on Metal The shim's partial specialization on a bare T* does match a pointer type written out in full, but not one deduced from an argument, which carries its address space. RDHUtils uses std::is_pointer to keep its pointer overloads apart from its reference ones, so the reference template was instantiated for a pointer and dereferenced it as a struct. metal::is_pointer is address-space aware, so the Metal branch forwards to it. --- GPU/Common/GPUCommonTypeTraits.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/GPU/Common/GPUCommonTypeTraits.h b/GPU/Common/GPUCommonTypeTraits.h index 3f83e151b0f33..6d72f164771bc 100644 --- a/GPU/Common/GPUCommonTypeTraits.h +++ b/GPU/Common/GPUCommonTypeTraits.h @@ -114,7 +114,13 @@ struct is_pointer_t { }; template struct is_pointer { +#ifdef __METAL__ + // A bare T* partial specialization does not match a pointer type deduced from + // an argument, which carries its address space; metal::is_pointer does. + enum { value = metal::is_pointer::value }; +#else enum { value = is_pointer_t::type>::value }; +#endif }; template