Skip to content

Commit f97c908

Browse files
committed
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.
1 parent 7d75d71 commit f97c908

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎GPU/Common/GPUCommonTypeTraits.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ struct is_pointer_t<T*> {
114114
};
115115
template <class T>
116116
struct is_pointer {
117+
#ifdef __METAL__
118+
// A bare T* partial specialization does not match a pointer type deduced from
119+
// an argument, which carries its address space; metal::is_pointer does.
120+
enum { value = metal::is_pointer<T>::value };
121+
#else
117122
enum { value = is_pointer_t<typename std::remove_cv<T>::type>::value };
123+
#endif
118124
};
119125

120126
template <class T>

0 commit comments

Comments
 (0)