MCPcopy Create free account
hub / github.com/AdvancedCompiler/AdvancedCompiler / MatMulKernel

Function MatMulKernel

code/Chapter12/12-5-hip-matrix.cpp:10–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#define BLOCK_SIZE 32
9
10__global__ void MatMulKernel(float *A, float *B, float *C, int m1, int n1, int n2)
11{
12 int y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y;
13 int x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x;
14 if(x < n2 && y < m1){
15 int tmp = 0;
16 for(int n = 0; n < n1; n++){
17 tmp += A[y * n1 + n] * B[n * n2 + x];
18 }
19 C[y * n2 + x] += tmp;
20 }
21}
22void Mul_Matrixdcu(float *A, float *B, float *C, int m1, int n1, int n2)
23{
24 float *d_A, *d_B, *d_C;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected