mirror of
https://github.com/karpathy/llm.c.git
synced 2026-07-28 20:35:09 -04:00
fix indexing in matmul_forward_kernel1
This commit is contained in:
parent
2d3a0fbe50
commit
d48b0d2b2b
1 changed files with 2 additions and 4 deletions
|
|
@ -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];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue