metal: the last twelve CUDA names (dim3, funnel shift, transcendentals, ldg/ldcv, shfl_up) - no undeclared name left
A full-list compile (-ferror-limit=0) found 350 errors behind the 20-error display cap, and they collapsed into twelve missing families. With dim3, __threadfence_system, __funnelshift_r/l, rsqrtf, __expf/__logf/__sinf/__cosf, sincosf, __ldg, __ldcv, __float2int_* and __shfl_up_sync in cuda_device_builtins.h, plus the C math names in scope, the counts are ds4_iq 52, ds4_gguf 42, ds4_kernels 132, ds4_vision 27 (was 66/67/185/32) AND the distinct-names list is now EMPTY: what is left is not a missing name but device construct - the <<<grid, block>>> launch syntax and shared-memory declarations that a C++ compiler cannot parse as written. That is the boundary of the host-compile audit, which was its purpose: the API surface is complete, and the remaining work is the MSL implementation itself.
This commit is contained in:
1 parent
dc61a065e3
commit
aaf3aa3a7c
2 files changed
+40
No files matched your search
@@ -7,6 +7,10 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
struct dim3 {
|
||||
unsigned x, y, z;
|
||||
dim3(unsigned _x = 1, unsigned _y = 1, unsigned _z = 1) : x(_x), y(_y), z(_z) {}
|
||||
};
|
||||
struct strata_dim3 { unsigned x, y, z; };
|
||||
static strata_dim3 threadIdx{0, 0, 0}, blockIdx{0, 0, 0}, blockDim{1, 1, 1}, gridDim{1, 1, 1};
|
||||
|
||||
@@ -116,3 +120,30 @@ static inline float __fdiv_rn(float a, float b) { return a / b; }
|
||||
static inline float __frcp_rn_(float a) { return 1.0f / a; }
|
||||
template <typename T> static inline T strata_min(T a, T b) { return a < b ? a : b; }
|
||||
template <typename T> static inline T strata_max(T a, T b) { return a > b ? a : b; }
|
||||
|
||||
// the last names the kernel sources use (a full-list compile found twelve families, 2026-10-23): the grid type above, a
|
||||
// system fence, the funnel shift, the hardware transcendentals and the read-only/volatile loads.
|
||||
static inline void __threadfence_system() {}
|
||||
static inline unsigned __funnelshift_r(unsigned lo, unsigned hi, unsigned shift) {
|
||||
const unsigned long long v = ((unsigned long long) hi << 32) | lo;
|
||||
return (unsigned) ((v >> (shift & 31)) & 0xffffffffu);
|
||||
}
|
||||
static inline unsigned __funnelshift_l(unsigned lo, unsigned hi, unsigned shift) {
|
||||
const unsigned long long v = ((unsigned long long) hi << 32) | lo;
|
||||
return (unsigned) (((v << (shift & 31)) >> 32) & 0xffffffffu);
|
||||
}
|
||||
static inline float rsqrtf(float a) { return 1.0f / __builtin_sqrtf(a); }
|
||||
static inline float __expf(float a) { return __builtin_expf(a); }
|
||||
static inline float __logf(float a) { return __builtin_logf(a); }
|
||||
static inline float __sinf(float a) { return __builtin_sinf(a); }
|
||||
static inline float __cosf(float a) { return __builtin_cosf(a); }
|
||||
static inline void sincosf(float a, float* s, float* c) { *s = __builtin_sinf(a); *c = __builtin_cosf(a); }
|
||||
static inline int __float2int_rn(float a) { return (int) __builtin_roundf(a); }
|
||||
static inline int __float2int_rz(float a) { return (int) a; }
|
||||
static inline int __float2int_rd(float a) { return (int) __builtin_floorf(a); }
|
||||
static inline int __float2int_ru(float a) { return (int) __builtin_ceilf(a); }
|
||||
template <typename T> static inline T __ldg(const T* p) { return *p; }
|
||||
template <typename T> static inline T __ldcv(const T* p) { return *p; }
|
||||
static inline unsigned __shfl_up_sync(unsigned, unsigned v, int) { return v; }
|
||||
static inline float __shfl_up_sync(unsigned, float v, int) { return v; }
|
||||
static inline unsigned __shfl_sync(unsigned, unsigned v, int) { return v; }
|
||||
@@ -42,6 +42,15 @@
|
||||
#endif
|
||||
|
||||
#include "cuda_device_builtins.h"
|
||||
#include <cmath>
|
||||
|
||||
using std::fmaxf;
|
||||
using std::fminf;
|
||||
using std::sqrtf;
|
||||
using std::fabsf;
|
||||
using std::powf;
|
||||
using std::expf;
|
||||
using std::logf;
|
||||
|
||||
// CUDA's headers put min/max in scope for integers; the sources rely on it
|
||||
template <typename T> static inline T min(T a, T b) { return strata_min(a, b); }
|
||||
|
||||
Reference in new issue
Block a user