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

Function MatMulKernel

code/Chapter12/12-6-mpi-hip-cannon.cpp:9–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected