#include #include #ifndef TOKENS #define TOKENS 131072 #endif #ifndef VOCAB #define VOCAB 128256 #endif #ifndef EMBED #define EMBED 2880 #endif #ifndef THREADS #define THREADS 256 #endif #ifdef INIT_HEADS extern "C" __global__ __launch_bounds__(THREADS) void embedding_bwd_init_heads(int *__restrict__ head) { const int v=blockIdx.x*THREADS+threadIdx.x; if(v=0; i=next_idx[i]) sum+=(float)grad_emb[(long long)i*EMBED+d]; out[(long long)token*EMBED+d]=(__hip_bfloat16)sum; } } #endif