Files
leleka/scripts/cuda-qsa-oracle/oracle_attention.cu
T

11 lines
696 B
Plaintext

#include "../../engine/strata/src/kernels/cuda/qsa.cu"
extern "C" void oracle_pack(const float*k,const float*v,uint16_t*kp,uint16_t*vp,const int*step,cudaStream_t s) {
// One-page geometry makes original cache append a contiguous two-head pack.
int*table; cudaMalloc(&table,4); const int zero=0; cudaMemcpy(table,&zero,4,cudaMemcpyHostToDevice);
strata::kernels::kv_append_kernel<<<2,256,0,s>>>(kp,vp,table,step,k,v,2,256,1,{});
cudaStreamSynchronize(s); cudaFree(table);
}
extern "C" void oracle_attention(const float*q,const uint16_t*k,const uint16_t*v,const int*step,float*y,cudaStream_t s) {
strata::kernels::qsa_attend_kernel<<<24,256,(2051+32)*4,s>>>(q,k,v,step,24,2,256,y,nullptr);
}