#include <stdlib.h>
#include <stdio.h>

void fill_matrix(double *mat, unsigned numRows, unsigned numCols)
{
    for(unsigned i=0; i < numRows; i++)
       for(unsigned j=0; j < numCols; j++)
       {
         mat[i*numCols + j] = i*2.1f + j*3.2f;
       }
}

void print_matrix_to_file(double *mat, unsigned numRows, unsigned numCols)
{
  const char *fname = "assignment2_5_out";
  FILE *f = fopen(fname, "w");
  for(unsigned i=0; i < numRows; i++)
    {
        for(unsigned j=0; j < numCols; j++)
        fprintf(f,"%4.4f ", mat[i*numCols + j]);
        fprintf(f,"\n");
    }
    fclose(f); }

__global__ void MatrixMulKernel_col_maj(double* M, double* N, double* P, int Width, int TILE_WIDTH) { 
    extern __shared__ double buffer[];
    double *ds_M = &buffer[0];
    double *ds_N = &buffer[TILE_WIDTH*TILE_WIDTH];

    //__shared__ double ds_M[TILE_WIDTH][TILE_WIDTH];
    //__shared__ double ds_N[TILE_WIDTH][TILE_WIDTH];

    // Generate IDs
    int bx = blockIdx.x;  int by = blockIdx.y;
    int tx = threadIdx.x; int ty = threadIdx.y;
    int Row = by * blockDim.y + ty;
    int Col = bx * blockDim.x + tx;

    ds_M[ty*TILE_WIDTH + tx] = 0.0;
    ds_N[ty*TILE_WIDTH + tx] = 0.0;
    
    double Pvalue=0;
    // Loop over the M and N tiles required to compute the P element
    for (int p = 0; p < (Width-1)/TILE_WIDTH+1; ++p) {
        if ( (Row < Width) && (threadIdx.x + (p*TILE_WIDTH)) < Width){
        // Collaborative loading of M and N tiles into shared memory
        ds_M[ty*TILE_WIDTH + tx] = M[Row*Width + p*TILE_WIDTH+tx];
        ds_N[ty*TILE_WIDTH + tx] = N[(p*TILE_WIDTH+ty)*Width + Col];
        }
        __syncthreads();

        for (int i = 0; i < TILE_WIDTH; ++i)
        Pvalue += ds_M[ty*TILE_WIDTH + i] * ds_N[i*TILE_WIDTH + tx];
        __syncthreads();
    }

    if (Row < Width && Col < Width){
    P[Row*Width+Col] = Pvalue;
    }
}

int main(int argc,char **argv) {
    int N;
    int TILE_WIDTH_ll[4], TILE_WIDTH;
    
    int loop,loop1, loop2; // loop variables
    float time_spent;

    N=8192;

    size_t size = N *N* sizeof(double);

    double*h_matA = (double*)malloc(size);
    double*h_matB = (double*)malloc(size);
    double*h_matC = (double*)malloc(size); // result

    fill_matrix(h_matA,N,N);
    fill_matrix(h_matB,N,N);

    for (loop = 0; loop<4; loop++){
        TILE_WIDTH_ll[loop]=pow(2,2+loop);
    }

    printf("\nMatrix A (first 10*10 inputs)\n");
    for(loop1 = 0; loop1 < 10; loop1++){
        for (loop2=0;loop2 < 10; loop2++)
            printf("%f ", *(h_matA + N*loop1 + loop2));
        printf("\n");
    }

    printf("\n\nMatrix B (first 10*10 inputs)\n");
    for(loop1 = 0; loop1 < 10; loop1++){
        for (loop2=0;loop2 < 10; loop2++)
            printf("%f ", *(h_matB + N*loop1 + loop2));
        printf("\n");
    }

    double* d_matA;   cudaMalloc(&d_matA, size);
    double* d_matB;   cudaMalloc(&d_matB, size);
    double* d_matC;   cudaMalloc(&d_matC, size);

    //GPU timing
    cudaEvent_t start, stop;
    cudaEventCreate(&start);
    cudaEventCreate(&stop);

    // Copy vectors from host memory to device memory
    cudaMemcpy(d_matA, h_matA, size,cudaMemcpyHostToDevice);
    cudaMemcpy(d_matB, h_matB, size,cudaMemcpyHostToDevice);

    for (loop =0;loop < 4; loop++){

        TILE_WIDTH=TILE_WIDTH_ll[loop];
        
        // Invoke kernel
        dim3 threadsPerBlock (TILE_WIDTH,TILE_WIDTH,1);
        dim3 blocksPerGrid ((N + threadsPerBlock.x) /threadsPerBlock.x,(N + threadsPerBlock.y) /threadsPerBlock.y,1);

        size_t blocksize = 2 * TILE_WIDTH * TILE_WIDTH;

        cudaEventRecord(start, 0); 
        MatrixMulKernel_col_maj<<<blocksPerGrid, threadsPerBlock, sizeof(double)*blocksize>>>(d_matA,d_matB, d_matC, N, TILE_WIDTH);
        //cudaDeviceSynchronize();//To synchronize the device
        cudaEventRecord(stop, 0);
        cudaEventSynchronize(stop);
        cudaEventElapsedTime(&time_spent, start, stop);
        printf("\nTime spent in col maj for tile %d x %d %f\n",TILE_WIDTH,TILE_WIDTH,time_spent);
        
        // h_C contains the result in host memory
        cudaMemcpy(h_matC, d_matC, size,cudaMemcpyDeviceToHost);

        printf("\n\nMatrix C (first 10*10 outputs)\n");
        for(loop1 = 0; loop1 < 10; loop1++){
            for (loop2=0;loop2 < 10; loop2++)
                printf("%f ", *(h_matC + N*loop1 + loop2));
            printf("\n");
        }
    }
    // Log outputs
    printf("\nWritting to file assignment_2_1_out as Mat C");
    print_matrix_to_file(h_matC,N,N);

    // Free device memory
    cudaFree(d_matA);
    cudaFree(d_matB);
    cudaFree(d_matC);

    // Free host memory
    free(h_matA);
    free(h_matB);
    free(h_matC);
    return 0;
}
	.file	"tmpxft_002ea106_00000000-6_ee16b068_5.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2032:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2032:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z11fill_matrixPdjj
	.type	_Z11fill_matrixPdjj, @function
_Z11fill_matrixPdjj:
.LFB2027:
	.cfi_startproc
	endbr64
	movss	.LC0(%rip), %xmm2
	movss	.LC1(%rip), %xmm3
	movq	%rdi, %r8
	xorl	%ecx, %ecx
	xorl	%edi, %edi
.L3:
	cmpl	%esi, %ecx
	je	.L12
	xorl	%eax, %eax
	movl	%ecx, %r9d
.L9:
	cmpl	%edx, %eax
	je	.L13
	movl	%eax, %r11d
	cvtsi2ssq	%r9, %xmm0
	leal	(%rax,%rdi), %r10d
	incl	%eax
	cvtsi2ssq	%r11, %xmm1
	mulss	%xmm2, %xmm0
	mulss	%xmm3, %xmm1
	addss	%xmm1, %xmm0
	cvtss2sd	%xmm0, %xmm0
	movsd	%xmm0, (%r8,%r10,8)
	jmp	.L9
.L13:
	incl	%ecx
	addl	%edx, %edi
	jmp	.L3
.L12:
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z11fill_matrixPdjj, .-_Z11fill_matrixPdjj
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"w"
.LC3:
	.string	"assignment2_5_out"
.LC4:
	.string	"%4.4f "
.LC5:
	.string	"\n"
	.text
	.globl	_Z20print_matrix_to_filePdjj
	.type	_Z20print_matrix_to_filePdjj, @function
_Z20print_matrix_to_filePdjj:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%edx, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	leaq	.LC3(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%esi, %ebx
	leaq	.LC2(%rip), %rsi
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	fopen@PLT
	movq	%rax, 8(%rsp)
.L15:
	cmpq	%rbx, %r12
	je	.L20
	movl	%r15d, %ebp
.L17:
	leal	(%r14,%r15), %eax
	cmpl	%eax, %ebp
	je	.L21
	movl	%ebp, %eax
	movq	8(%rsp), %rdi
	leaq	.LC4(%rip), %rdx
	incl	%ebp
	movsd	0(%r13,%rax,8), %xmm0
	movl	$2, %esi
	movb	$1, %al
	call	__fprintf_chk@PLT
	jmp	.L17
.L21:
	movq	8(%rsp), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	incq	%r12
	leaq	.LC5(%rip), %rdx
	movl	%ebp, %r15d
	call	__fprintf_chk@PLT
	jmp	.L15
.L20:
	movq	8(%rsp), %rdi
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	fclose@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z20print_matrix_to_filePdjj, .-_Z20print_matrix_to_filePdjj
	.globl	_Z49__device_stub__Z23MatrixMulKernel_col_majPdS_S_iiPdS_S_ii
	.type	_Z49__device_stub__Z23MatrixMulKernel_col_majPdS_S_iiPdS_S_ii, @function
_Z49__device_stub__Z23MatrixMulKernel_col_majPdS_S_iiPdS_S_ii:
.LFB2054:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L22
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z23MatrixMulKernel_col_majPdS_S_ii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L22:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2054:
	.size	_Z49__device_stub__Z23MatrixMulKernel_col_majPdS_S_iiPdS_S_ii, .-_Z49__device_stub__Z23MatrixMulKernel_col_majPdS_S_iiPdS_S_ii
	.globl	_Z23MatrixMulKernel_col_majPdS_S_ii
	.type	_Z23MatrixMulKernel_col_majPdS_S_ii, @function
_Z23MatrixMulKernel_col_majPdS_S_ii:
.LFB2055:
	.cfi_startproc
	endbr64
	jmp	_Z49__device_stub__Z23MatrixMulKernel_col_majPdS_S_iiPdS_S_ii
	.cfi_endproc
.LFE2055:
	.size	_Z23MatrixMulKernel_col_majPdS_S_ii, .-_Z23MatrixMulKernel_col_majPdS_S_ii
	.section	.rodata.str1.1
.LC7:
	.string	"\nMatrix A (first 10*10 inputs)\n"
.LC8:
	.string	"%f "
.LC9:
	.string	"\n\nMatrix B (first 10*10 inputs)\n"
.LC10:
	.string	"\nTime spent in col maj for tile %d x %d %f\n"
.LC11:
	.string	"\n\nMatrix C (first 10*10 outputs)\n"
.LC12:
	.string	"\nWritting to file assignment_2_1_out as Mat C"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$536870912, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movl	$536870912, %edi
	movq	%rax, %r13
	call	malloc@PLT
	movl	$536870912, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%r13, %rdi
	movq	%rax, %rbp
	call	_Z11fill_matrixPdjj
	movq	%r12, %rdi
	call	_Z11fill_matrixPdjj
.L28:
	leal	2(%rbx), %eax
	movsd	.LC6(%rip), %xmm0
	leaq	88(%rsp), %r15
	cvtsi2sdl	%eax, %xmm1
	call	pow@PLT
	cvttsd2sil	%xmm0, %eax
	movl	%eax, (%r15,%rbx,4)
	incq	%rbx
	cmpq	$4, %rbx
	jne	.L28
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__printf_chk@PLT
.L29:
	leaq	0(%r13,%rbx,8), %rdx
	xorl	%r14d, %r14d
.L30:
	movsd	(%rdx,%r14,8), %xmm0
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	incq	%r14
	movq	%rdx, (%rsp)
	call	__printf_chk@PLT
	cmpq	$10, %r14
	movq	(%rsp), %rdx
	jne	.L30
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	addq	$8192, %rbx
	call	__printf_chk@PLT
	cmpq	$81920, %rbx
	jne	.L29
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__printf_chk@PLT
.L32:
	leaq	(%r12,%rbx,8), %rdx
	xorl	%r14d, %r14d
.L33:
	movsd	(%rdx,%r14,8), %xmm0
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	incq	%r14
	movq	%rdx, (%rsp)
	call	__printf_chk@PLT
	cmpq	$10, %r14
	movq	(%rsp), %rdx
	jne	.L33
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	addq	$8192, %rbx
	call	__printf_chk@PLT
	cmpq	$81920, %rbx
	jne	.L32
	leaq	24(%rsp), %rdi
	movl	$536870912, %esi
	xorl	%r14d, %r14d
	call	cudaMalloc@PLT
	leaq	32(%rsp), %rdi
	movl	$536870912, %esi
	call	cudaMalloc@PLT
	movl	$536870912, %esi
	leaq	40(%rsp), %rdi
	call	cudaMalloc@PLT
	leaq	48(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	56(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rsi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movq	%r12, %rsi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
.L39:
	movl	(%r15,%r14,4), %ebx
	xorl	%edx, %edx
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	movl	$1, 72(%rsp)
	leal	8192(%rbx), %eax
	movl	$1, 84(%rsp)
	divl	%ebx
	movl	%eax, 76(%rsp)
	movl	%eax, 80(%rsp)
	call	cudaEventRecord@PLT
	movl	%ebx, %eax
	movl	%ebx, 64(%rsp)
	movl	72(%rsp), %ecx
	imull	%ebx, %eax
	movl	%ebx, 68(%rsp)
	movq	76(%rsp), %rdi
	xorl	%r9d, %r9d
	movq	64(%rsp), %rdx
	movl	84(%rsp), %esi
	addl	%eax, %eax
	cltq
	leaq	0(,%rax,8), %r8
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L35
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	%ebx, %r8d
	movl	$8192, %ecx
	movq	24(%rsp), %rdi
	call	_Z49__device_stub__Z23MatrixMulKernel_col_majPdS_S_iiPdS_S_ii
.L35:
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	20(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movl	%ebx, %ecx
	movl	%ebx, %edx
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	20(%rsp), %xmm0
	xorl	%ebx, %ebx
	call	__printf_chk@PLT
	movq	40(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L36:
	leaq	0(%rbp,%rbx,8), %rcx
	xorl	%edx, %edx
.L37:
	movsd	(%rcx,%rdx,8), %xmm0
	movl	$2, %edi
	movb	$1, %al
	movq	%rdx, (%rsp)
	leaq	.LC8(%rip), %rsi
	movq	%rcx, 8(%rsp)
	call	__printf_chk@PLT
	movq	(%rsp), %rdx
	movq	8(%rsp), %rcx
	incq	%rdx
	cmpq	$10, %rdx
	jne	.L37
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	addq	$8192, %rbx
	call	__printf_chk@PLT
	cmpq	$81920, %rbx
	jne	.L36
	incq	%r14
	cmpq	$4, %r14
	jne	.L39
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%rbp, %rdi
	call	_Z20print_matrix_to_filePdjj
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	main, .-main
	.section	.rodata.str1.1
.LC13:
	.string	"_Z23MatrixMulKernel_col_majPdS_S_ii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2057:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC13(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z23MatrixMulKernel_col_majPdS_S_ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2057:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC0:
	.long	1074161254
	.align 4
.LC1:
	.long	1078774989
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC6:
	.long	0
	.long	1073741824
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdlib.h>
#include <stdio.h>

void fill_matrix(double *mat, unsigned numRows, unsigned numCols)
{
    for(unsigned i=0; i < numRows; i++)
       for(unsigned j=0; j < numCols; j++)
       {
         mat[i*numCols + j] = i*2.1f + j*3.2f;
       }
}

void print_matrix_to_file(double *mat, unsigned numRows, unsigned numCols)
{
  const char *fname = "assignment2_5_out";
  FILE *f = fopen(fname, "w");
  for(unsigned i=0; i < numRows; i++)
    {
        for(unsigned j=0; j < numCols; j++)
        fprintf(f,"%4.4f ", mat[i*numCols + j]);
        fprintf(f,"\n");
    }
    fclose(f); }

__global__ void MatrixMulKernel_col_maj(double* M, double* N, double* P, int Width, int TILE_WIDTH) { 
    extern __shared__ double buffer[];
    double *ds_M = &buffer[0];
    double *ds_N = &buffer[TILE_WIDTH*TILE_WIDTH];

    //__shared__ double ds_M[TILE_WIDTH][TILE_WIDTH];
    //__shared__ double ds_N[TILE_WIDTH][TILE_WIDTH];

    // Generate IDs
    int bx = blockIdx.x;  int by = blockIdx.y;
    int tx = threadIdx.x; int ty = threadIdx.y;
    int Row = by * blockDim.y + ty;
    int Col = bx * blockDim.x + tx;

    ds_M[ty*TILE_WIDTH + tx] = 0.0;
    ds_N[ty*TILE_WIDTH + tx] = 0.0;
    
    double Pvalue=0;
    // Loop over the M and N tiles required to compute the P element
    for (int p = 0; p < (Width-1)/TILE_WIDTH+1; ++p) {
        if ( (Row < Width) && (threadIdx.x + (p*TILE_WIDTH)) < Width){
        // Collaborative loading of M and N tiles into shared memory
        ds_M[ty*TILE_WIDTH + tx] = M[Row*Width + p*TILE_WIDTH+tx];
        ds_N[ty*TILE_WIDTH + tx] = N[(p*TILE_WIDTH+ty)*Width + Col];
        }
        __syncthreads();

        for (int i = 0; i < TILE_WIDTH; ++i)
        Pvalue += ds_M[ty*TILE_WIDTH + i] * ds_N[i*TILE_WIDTH + tx];
        __syncthreads();
    }

    if (Row < Width && Col < Width){
    P[Row*Width+Col] = Pvalue;
    }
}

int main(int argc,char **argv) {
    int N;
    int TILE_WIDTH_ll[4], TILE_WIDTH;
    
    int loop,loop1, loop2; // loop variables
    float time_spent;

    N=8192;

    size_t size = N *N* sizeof(double);

    double*h_matA = (double*)malloc(size);
    double*h_matB = (double*)malloc(size);
    double*h_matC = (double*)malloc(size); // result

    fill_matrix(h_matA,N,N);
    fill_matrix(h_matB,N,N);

    for (loop = 0; loop<4; loop++){
        TILE_WIDTH_ll[loop]=pow(2,2+loop);
    }

    printf("\nMatrix A (first 10*10 inputs)\n");
    for(loop1 = 0; loop1 < 10; loop1++){
        for (loop2=0;loop2 < 10; loop2++)
            printf("%f ", *(h_matA + N*loop1 + loop2));
        printf("\n");
    }

    printf("\n\nMatrix B (first 10*10 inputs)\n");
    for(loop1 = 0; loop1 < 10; loop1++){
        for (loop2=0;loop2 < 10; loop2++)
            printf("%f ", *(h_matB + N*loop1 + loop2));
        printf("\n");
    }

    double* d_matA;   hipMalloc(&d_matA, size);
    double* d_matB;   hipMalloc(&d_matB, size);
    double* d_matC;   hipMalloc(&d_matC, size);

    //GPU timing
    hipEvent_t start, stop;
    hipEventCreate(&start);
    hipEventCreate(&stop);

    // Copy vectors from host memory to device memory
    hipMemcpy(d_matA, h_matA, size,hipMemcpyHostToDevice);
    hipMemcpy(d_matB, h_matB, size,hipMemcpyHostToDevice);

    for (loop =0;loop < 4; loop++){

        TILE_WIDTH=TILE_WIDTH_ll[loop];
        
        // Invoke kernel
        dim3 threadsPerBlock (TILE_WIDTH,TILE_WIDTH,1);
        dim3 blocksPerGrid ((N + threadsPerBlock.x) /threadsPerBlock.x,(N + threadsPerBlock.y) /threadsPerBlock.y,1);

        size_t blocksize = 2 * TILE_WIDTH * TILE_WIDTH;

        hipEventRecord(start, 0); 
        MatrixMulKernel_col_maj<<<blocksPerGrid, threadsPerBlock, sizeof(double)*blocksize>>>(d_matA,d_matB, d_matC, N, TILE_WIDTH);
        //cudaDeviceSynchronize();//To synchronize the device
        hipEventRecord(stop, 0);
        hipEventSynchronize(stop);
        hipEventElapsedTime(&time_spent, start, stop);
        printf("\nTime spent in col maj for tile %d x %d %f\n",TILE_WIDTH,TILE_WIDTH,time_spent);
        
        // h_C contains the result in host memory
        hipMemcpy(h_matC, d_matC, size,hipMemcpyDeviceToHost);

        printf("\n\nMatrix C (first 10*10 outputs)\n");
        for(loop1 = 0; loop1 < 10; loop1++){
            for (loop2=0;loop2 < 10; loop2++)
                printf("%f ", *(h_matC + N*loop1 + loop2));
            printf("\n");
        }
    }
    // Log outputs
    printf("\nWritting to file assignment_2_1_out as Mat C");
    print_matrix_to_file(h_matC,N,N);

    // Free device memory
    hipFree(d_matA);
    hipFree(d_matB);
    hipFree(d_matC);

    // Free host memory
    free(h_matA);
    free(h_matB);
    free(h_matC);
    return 0;
}
	.text
	.file	"ee16b068_5.hip"
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z11fill_matrixPdjj
.LCPI0_0:
	.long	0x40066666                      # float 2.0999999
.LCPI0_1:
	.long	0x404ccccd                      # float 3.20000005
	.text
	.globl	_Z11fill_matrixPdjj
	.type	_Z11fill_matrixPdjj,@function
_Z11fill_matrixPdjj:                    # @_Z11fill_matrixPdjj
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	je	.LBB0_6
# %bb.1:                                # %.preheader.lr.ph
	movl	%edx, %eax
	xorl	%ecx, %ecx
	movss	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movss	.LCPI0_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	xorl	%r8d, %r8d
.LBB0_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_4 Depth 2
	testl	%edx, %edx
	je	.LBB0_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB0_2 Depth=1
	movl	%r8d, %r9d
	xorps	%xmm2, %xmm2
	cvtsi2ss	%r9, %xmm2
	mulss	%xmm0, %xmm2
	xorl	%r9d, %r9d
.LBB0_4:                                #   Parent Loop BB0_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%r9d, %r10d
	xorps	%xmm3, %xmm3
	cvtsi2ss	%r10, %xmm3
	mulss	%xmm1, %xmm3
	addss	%xmm2, %xmm3
	cvtss2sd	%xmm3, %xmm3
	leal	(%rcx,%r9), %r10d
	movsd	%xmm3, (%rdi,%r10,8)
	incq	%r9
	cmpq	%r9, %rax
	jne	.LBB0_4
.LBB0_5:                                # %._crit_edge
                                        #   in Loop: Header=BB0_2 Depth=1
	incl	%r8d
	addq	%rax, %rcx
	cmpl	%esi, %r8d
	jne	.LBB0_2
.LBB0_6:                                # %._crit_edge15
	retq
.Lfunc_end0:
	.size	_Z11fill_matrixPdjj, .Lfunc_end0-_Z11fill_matrixPdjj
	.cfi_endproc
                                        # -- End function
	.globl	_Z20print_matrix_to_filePdjj    # -- Begin function _Z20print_matrix_to_filePdjj
	.type	_Z20print_matrix_to_filePdjj,@function
_Z20print_matrix_to_filePdjj:           # @_Z20print_matrix_to_filePdjj
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebx
	movl	%esi, %ebp
	movq	%rdi, %r14
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	callq	fopen
	movq	%rax, %r15
	movl	%ebp, 12(%rsp)                  # 4-byte Spill
	testl	%ebp, %ebp
	je	.LBB1_4
# %bb.1:                                # %.preheader.lr.ph
	movl	%ebx, %ecx
	movl	%ebx, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	xorl	%ebx, %ebx
	xorl	%ebp, %ebp
	movl	%ecx, 8(%rsp)                   # 4-byte Spill
.LBB1_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_5 Depth 2
	movq	16(%rsp), %r12                  # 8-byte Reload
	movl	%ebx, %r13d
	testl	%ecx, %ecx
	je	.LBB1_3
.LBB1_5:                                #   Parent Loop BB1_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%r13d, %eax
	movsd	(%r14,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str.2, %esi
	movq	%r15, %rdi
	movb	$1, %al
	callq	fprintf
	incl	%r13d
	decq	%r12
	jne	.LBB1_5
.LBB1_3:                                # %._crit_edge
                                        #   in Loop: Header=BB1_2 Depth=1
	movl	$10, %edi
	movq	%r15, %rsi
	callq	fputc@PLT
	incl	%ebp
	movl	8(%rsp), %ecx                   # 4-byte Reload
	addl	%ecx, %ebx
	cmpl	12(%rsp), %ebp                  # 4-byte Folded Reload
	jne	.LBB1_2
.LBB1_4:                                # %._crit_edge17
	movq	%r15, %rdi
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	fclose                          # TAILCALL
.Lfunc_end1:
	.size	_Z20print_matrix_to_filePdjj, .Lfunc_end1-_Z20print_matrix_to_filePdjj
	.cfi_endproc
                                        # -- End function
	.globl	_Z38__device_stub__MatrixMulKernel_col_majPdS_S_ii # -- Begin function _Z38__device_stub__MatrixMulKernel_col_majPdS_S_ii
	.type	_Z38__device_stub__MatrixMulKernel_col_majPdS_S_ii,@function
_Z38__device_stub__MatrixMulKernel_col_majPdS_S_ii: # @_Z38__device_stub__MatrixMulKernel_col_majPdS_S_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	movq	%rsp, %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z23MatrixMulKernel_col_majPdS_S_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z38__device_stub__MatrixMulKernel_col_majPdS_S_ii, .Lfunc_end2-_Z38__device_stub__MatrixMulKernel_col_majPdS_S_ii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI3_0:
	.long	0x40066666                      # float 2.0999999
.LCPI3_1:
	.long	0x404ccccd                      # float 3.20000005
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI3_2:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$536870912, %edi                # imm = 0x20000000
	callq	malloc
	movq	%rax, %rbx
	movl	$536870912, %edi                # imm = 0x20000000
	callq	malloc
	movq	%rax, %r13
	movl	$536870912, %edi                # imm = 0x20000000
	callq	malloc
	movq	%rax, %r15
	xorl	%eax, %eax
	movss	.LCPI3_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movss	.LCPI3_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	movq	%rbx, (%rsp)                    # 8-byte Spill
.LBB3_1:                                # %.preheader.i
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_2 Depth 2
	movl	%eax, %edx
	xorps	%xmm2, %xmm2
	cvtsi2ss	%rdx, %xmm2
	mulss	%xmm0, %xmm2
	xorl	%edx, %edx
.LBB3_2:                                #   Parent Loop BB3_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%edx, %esi
	xorps	%xmm3, %xmm3
	cvtsi2ss	%rsi, %xmm3
	mulss	%xmm1, %xmm3
	addss	%xmm2, %xmm3
	cvtss2sd	%xmm3, %xmm3
	movsd	%xmm3, (%rbx,%rdx,8)
	incq	%rdx
	cmpq	$8192, %rdx                     # imm = 0x2000
	jne	.LBB3_2
# %bb.3:                                # %._crit_edge.i
                                        #   in Loop: Header=BB3_1 Depth=1
	incl	%eax
	addq	$65536, %rbx                    # imm = 0x10000
	cmpl	$8192, %eax                     # imm = 0x2000
	jne	.LBB3_1
# %bb.4:                                # %.preheader.i82.preheader
	xorl	%eax, %eax
	movq	%r13, %rcx
.LBB3_5:                                # %.preheader.i82
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_6 Depth 2
	movl	%eax, %edx
	xorps	%xmm2, %xmm2
	cvtsi2ss	%rdx, %xmm2
	mulss	%xmm0, %xmm2
	xorl	%edx, %edx
.LBB3_6:                                #   Parent Loop BB3_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%edx, %esi
	xorps	%xmm3, %xmm3
	cvtsi2ss	%rsi, %xmm3
	mulss	%xmm1, %xmm3
	addss	%xmm2, %xmm3
	cvtss2sd	%xmm3, %xmm3
	movsd	%xmm3, (%rcx,%rdx,8)
	incq	%rdx
	cmpq	$8192, %rdx                     # imm = 0x2000
	jne	.LBB3_6
# %bb.7:                                # %._crit_edge.i87
                                        #   in Loop: Header=BB3_5 Depth=1
	incl	%eax
	addq	$65536, %rcx                    # imm = 0x10000
	cmpl	$8192, %eax                     # imm = 0x2000
	jne	.LBB3_5
# %bb.8:                                # %_Z11fill_matrixPdjj.exit89.preheader
	xorl	%ebx, %ebx
.LBB3_9:                                # %_Z11fill_matrixPdjj.exit89
                                        # =>This Inner Loop Header: Depth=1
	leal	2(%rbx), %edi
	movsd	.LCPI3_2(%rip), %xmm0           # xmm0 = mem[0],zero
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %eax
	movl	%eax, 64(%rsp,%rbx,4)
	incq	%rbx
	cmpq	$4, %rbx
	jne	.LBB3_9
# %bb.10:
	movl	$.Lstr, %edi
	callq	puts@PLT
	xorl	%ebx, %ebx
	movq	(%rsp), %r14                    # 8-byte Reload
.LBB3_11:                               # %.preheader93
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_12 Depth 2
	xorl	%r12d, %r12d
.LBB3_12:                               #   Parent Loop BB3_11 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r14,%r12,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	incq	%r12
	cmpq	$10, %r12
	jne	.LBB3_12
# %bb.13:                               #   in Loop: Header=BB3_11 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%rbx
	addq	$65536, %r14                    # imm = 0x10000
	cmpq	$10, %rbx
	jne	.LBB3_11
# %bb.14:
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	xorl	%ebx, %ebx
	movq	%r13, 32(%rsp)                  # 8-byte Spill
.LBB3_15:                               # %.preheader92
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_16 Depth 2
	xorl	%r12d, %r12d
.LBB3_16:                               #   Parent Loop BB3_15 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r13,%r12,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	incq	%r12
	cmpq	$10, %r12
	jne	.LBB3_16
# %bb.17:                               #   in Loop: Header=BB3_15 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%rbx
	addq	$65536, %r13                    # imm = 0x10000
	cmpq	$10, %rbx
	jne	.LBB3_15
# %bb.18:
	leaq	56(%rsp), %r13
	movl	$536870912, %esi                # imm = 0x20000000
	movq	%r13, %rdi
	callq	hipMalloc
	leaq	48(%rsp), %r12
	movl	$536870912, %esi                # imm = 0x20000000
	movq	%r12, %rdi
	callq	hipMalloc
	leaq	16(%rsp), %rdi
	movl	$536870912, %esi                # imm = 0x20000000
	callq	hipMalloc
	leaq	40(%rsp), %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	movq	(%r13), %rdi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	(%rsp), %rsi                    # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	32(%rsp), %rsi                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	xorl	%r12d, %r12d
.LBB3_19:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_22 Depth 2
                                        #       Child Loop BB3_23 Depth 3
	movl	64(%rsp,%r12,4), %r13d
	movq	%r13, %rbp
	shlq	$32, %rbp
	orq	%r13, %rbp
	leal	8192(%r13), %eax
	xorl	%edx, %edx
	divl	%r13d
                                        # kill: def $eax killed $eax def $rax
	movq	%rax, %rbx
	shlq	$32, %rbx
	orq	%rax, %rbx
	movl	%r13d, %eax
	imull	%r13d, %eax
	addl	%eax, %eax
	movslq	%eax, %r14
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	shlq	$3, %r14
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	movq	%r14, %r8
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_21
# %bb.20:                               #   in Loop: Header=BB3_19 Depth=1
	movq	56(%rsp), %rdi
	movq	48(%rsp), %rsi
	movq	16(%rsp), %rdx
	movl	$8192, %ecx                     # imm = 0x2000
	movl	%r13d, %r8d
	callq	_Z38__device_stub__MatrixMulKernel_col_majPdS_S_ii
.LBB3_21:                               #   in Loop: Header=BB3_19 Depth=1
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	40(%rsp), %rsi
	movq	8(%rsp), %rdx
	leaq	28(%rsp), %rdi
	callq	hipEventElapsedTime
	xorps	%xmm0, %xmm0
	cvtss2sd	28(%rsp), %xmm0
	movl	$.L.str.7, %edi
	movl	%r13d, %esi
	movl	%r13d, %edx
	movb	$1, %al
	callq	printf
	movq	16(%rsp), %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movq	%r15, %rbx
	xorl	%r14d, %r14d
.LBB3_22:                               # %.preheader
                                        #   Parent Loop BB3_19 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB3_23 Depth 3
	xorl	%r13d, %r13d
.LBB3_23:                               #   Parent Loop BB3_19 Depth=1
                                        #     Parent Loop BB3_22 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	(%rbx,%r13,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	incq	%r13
	cmpq	$10, %r13
	jne	.LBB3_23
# %bb.24:                               #   in Loop: Header=BB3_22 Depth=2
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r14
	addq	$65536, %rbx                    # imm = 0x10000
	cmpq	$10, %r14
	jne	.LBB3_22
# %bb.25:                               #   in Loop: Header=BB3_19 Depth=1
	incq	%r12
	cmpq	$4, %r12
	jne	.LBB3_19
# %bb.26:
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	callq	printf
	movq	%r15, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movl	$8192, %edx                     # imm = 0x2000
	callq	_Z20print_matrix_to_filePdjj
	movq	56(%rsp), %rdi
	callq	hipFree
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi                    # 8-byte Reload
	callq	free
	movq	32(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%r15, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z23MatrixMulKernel_col_majPdS_S_ii, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB5_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"assignment2_5_out"
	.size	.L.str, 18

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"w"
	.size	.L.str.1, 2

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"%4.4f "
	.size	.L.str.2, 7

	.type	_Z23MatrixMulKernel_col_majPdS_S_ii,@object # @_Z23MatrixMulKernel_col_majPdS_S_ii
	.section	.rodata,"a",@progbits
	.globl	_Z23MatrixMulKernel_col_majPdS_S_ii
	.p2align	3, 0x0
_Z23MatrixMulKernel_col_majPdS_S_ii:
	.quad	_Z38__device_stub__MatrixMulKernel_col_majPdS_S_ii
	.size	_Z23MatrixMulKernel_col_majPdS_S_ii, 8

	.type	.L.str.5,@object                # @.str.5
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.5:
	.asciz	"%f "
	.size	.L.str.5, 4

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"\nTime spent in col maj for tile %d x %d %f\n"
	.size	.L.str.7, 44

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"\nWritting to file assignment_2_1_out as Mat C"
	.size	.L.str.9, 46

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z23MatrixMulKernel_col_majPdS_S_ii"
	.size	.L__unnamed_1, 36

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"\nMatrix A (first 10*10 inputs)"
	.size	.Lstr, 31

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"\n\nMatrix B (first 10*10 inputs)"
	.size	.Lstr.1, 32

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"\n\nMatrix C (first 10*10 outputs)"
	.size	.Lstr.2, 33

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z38__device_stub__MatrixMulKernel_col_majPdS_S_ii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z23MatrixMulKernel_col_majPdS_S_ii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z23MatrixMulKernel_col_majPdS_S_ii ; -- Begin function _Z23MatrixMulKernel_col_majPdS_S_ii
	.globl	_Z23MatrixMulKernel_col_majPdS_S_ii
	.p2align	8
	.type	_Z23MatrixMulKernel_col_majPdS_S_ii,@function
_Z23MatrixMulKernel_col_majPdS_S_ii:    ; @_Z23MatrixMulKernel_col_majPdS_S_ii
; %bb.0:
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b32 s0, s[0:1], 0x2c
	v_bfe_u32 v3, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s3, s11, 31
	s_lshr_b32 s13, s0, 16
	s_add_i32 s2, s11, s3
	s_add_i32 s16, s10, -1
	s_xor_b32 s1, s2, s3
	s_mov_b32 s2, 0
	v_cvt_f32_u32_e32 v1, s1
	v_and_b32_e32 v2, 0x3ff, v0
	s_sub_i32 s17, 0, s1
	s_and_b32 s0, s0, 0xffff
	s_mul_i32 s12, s11, s11
	v_rcp_iflag_f32_e32 v1, v1
	v_mul_lo_u32 v10, v3, s11
	s_lshl_b32 s12, s12, 3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	s_add_i32 s12, s12, 0
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v0, 0x4f7ffffe, v1
	v_cvt_u32_f32_e32 v4, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[0:1], null, s15, s13, v[3:4]
	v_readfirstlane_b32 s13, v4
	s_ashr_i32 s15, s16, 31
	v_mad_u64_u32 v[4:5], null, s14, s0, v[2:3]
	s_add_i32 s16, s16, s15
	s_mul_i32 s17, s17, s13
	s_xor_b32 s16, s16, s15
	s_mul_hi_u32 s17, s13, s17
	s_xor_b32 s14, s15, s3
	s_add_i32 s13, s13, s17
	s_mov_b32 s3, s2
	s_mul_hi_u32 s0, s16, s13
	v_mov_b32_e32 v9, s3
	s_mul_i32 s13, s0, s1
	s_add_i32 s15, s0, 1
	s_sub_i32 s13, s16, s13
	v_add_lshl_u32 v6, v10, v2, 3
	s_sub_i32 s16, s13, s1
	s_cmp_ge_u32 s13, s1
	v_mov_b32_e32 v8, s2
	s_cselect_b32 s0, s15, s0
	v_add_nc_u32_e32 v7, s12, v6
	s_cselect_b32 s13, s16, s13
	s_add_i32 s15, s0, 1
	s_cmp_ge_u32 s13, s1
	v_add_nc_u32_e32 v1, 0, v6
	s_cselect_b32 s0, s15, s0
	v_mov_b32_e32 v5, 0
	s_xor_b32 s0, s0, s14
	v_mov_b32_e32 v6, 0
	s_sub_i32 s1, s0, s14
	ds_store_b64 v1, v[8:9]
	ds_store_b64 v7, v[8:9]
	s_cmp_lt_i32 s1, 0
	s_cbranch_scc1 .LBB0_8
; %bb.1:                                ; %.lr.ph80
	v_mul_lo_u32 v8, v0, s10
	v_mov_b32_e32 v5, 0
	v_cmp_gt_i32_e64 s0, s10, v0
	v_lshl_add_u32 v9, v2, 3, s12
	v_lshl_add_u32 v10, v10, 3, 0
	v_mov_b32_e32 v6, 0
	s_cmp_gt_i32 s11, 0
	s_cselect_b32 s3, -1, 0
	s_lshl_b32 s12, s11, 3
.LBB0_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	s_mul_i32 s14, s2, s11
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v11, s14, v2
	v_cmp_gt_u32_e32 vcc_lo, s10, v11
	s_and_b32 s15, s0, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s13, s15
	s_cbranch_execz .LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	v_add_nc_u32_e32 v12, s14, v3
	v_add_nc_u32_e32 v11, v11, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[13:14], null, v12, s10, v[4:5]
	v_ashrrev_i32_e32 v12, 31, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[11:12], 3, v[11:12]
	v_ashrrev_i32_e32 v14, 31, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v11, vcc_lo, s4, v11
	v_lshlrev_b64 v[13:14], 3, v[13:14]
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e32 v12, vcc_lo, s5, v12, vcc_lo
	v_add_co_u32 v13, vcc_lo, s6, v13
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v14, vcc_lo, s7, v14, vcc_lo
	global_load_b64 v[11:12], v[11:12], off
	global_load_b64 v[13:14], v[13:14], off
	s_waitcnt vmcnt(1)
	ds_store_b64 v1, v[11:12]
	s_waitcnt vmcnt(0)
	ds_store_b64 v7, v[13:14]
.LBB0_4:                                ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s13
	v_dual_mov_b32 v11, v10 :: v_dual_mov_b32 v12, v9
	s_and_not1_b32 vcc_lo, exec_lo, s3
	s_mov_b32 s13, s11
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_vccnz .LBB0_6
.LBB0_5:                                ; %.lr.ph
                                        ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ds_load_b64 v[13:14], v11
	ds_load_b64 v[15:16], v12
	v_add_nc_u32_e32 v12, s12, v12
	v_add_nc_u32_e32 v11, 8, v11
	s_add_i32 s13, s13, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s13, 0
	s_waitcnt lgkmcnt(0)
	v_fma_f64 v[5:6], v[13:14], v[15:16], v[5:6]
	s_cbranch_scc0 .LBB0_5
.LBB0_6:                                ; %._crit_edge
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_add_i32 s13, s2, 1
	s_cmp_eq_u32 s2, s1
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_2 Depth=1
	s_mov_b32 s2, s13
	s_branch .LBB0_2
.LBB0_8:                                ; %Flow105
	v_max_i32_e32 v1, v0, v4
	s_mov_b32 s0, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s10, v1
	s_cbranch_execz .LBB0_10
; %bb.9:
	v_mad_u64_u32 v[1:2], null, v0, s10, v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v2, 31, v1
	v_lshlrev_b64 v[0:1], 3, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s8, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s9, v1, vcc_lo
	global_store_b64 v[0:1], v[5:6], off
.LBB0_10:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z23MatrixMulKernel_col_majPdS_S_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 17
		.amdhsa_next_free_sgpr 18
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z23MatrixMulKernel_col_majPdS_S_ii, .Lfunc_end0-_Z23MatrixMulKernel_col_majPdS_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 704
; NumSgprs: 20
; NumVgprs: 17
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 20
; NumVGPRsForWavesPerEU: 17
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         152
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z23MatrixMulKernel_col_majPdS_S_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     20
    .sgpr_spill_count: 0
    .symbol:         _Z23MatrixMulKernel_col_majPdS_S_ii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     17
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
