Merge branch 'patricxu-master'

This commit is contained in:
Andrej Karpathy 2024-04-22 00:28:00 +00:00
commit 6984e83c6e

View file

@ -72,11 +72,9 @@ __global__ void matmul_forward_kernel1(float* out,
int bt = blockIdx.x * blockDim.x + threadIdx.x;
int oc = blockIdx.y * blockDim.y + threadIdx.y;
if (bt < BT && oc < OC) {
int b = bt / BT;
int t = bt % BT;
float val = (bias != NULL) ? bias[oc] : 0.0f;
const float* wrow = weight + oc*C;
const float* inp_bt = inp + b * BT * C + t * C;
const float* wrow = weight + oc * C;
const float* inp_bt = inp + bt * C;
for (int i = 0; i < C; i++) {
val += inp_bt[i] * wrow[i];
}