/* Program : To find the run-time for the matrix multiplication kernel without tiling for various block sizes
 * Author : Anant Shah
 * Date : 13-9-2018
 * Roll Number : EE16B105
 **/

#include<stdio.h>

#define ERROR_HANDLER(error_msg,line) error_handler(error_msg,line)
#define NUM_THREADS_X 16
#define NUM_THREADS_Y 16
#define X_1 4
#define Y_1 4
#define X_2 4
#define Y_2 8
#define X_3 8
#define Y_3 4
#define X_4 8
#define Y_4 8
#define X_5 8
#define Y_5 16
#define X_6 16
#define Y_6 8
#define X_7 16
#define Y_7 32
#define SIZE 8192

void error_handler(cudaError_t error_msg,int line){
	/* Function to check if a CUDA statement resulted in a function */
	if(error_msg!=cudaSuccess){
		printf("%s in %s at %d",cudaGetErrorString(error_msg),__FILE__,line);
		exit(EXIT_FAILURE);
	}
}

void fill_matrix(double *mat,unsigned numRows,unsigned numCols){
	/* Function to fill a mtrix with values */
	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){
	/* Function to wite a matrix into a file */
	const char 	*fname = "assignment2_out";
	FILE		*f = fopen(fname,"a");

	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 matrixMul(double *M,double *N,double *P,int width){
	/* Kernel to perform the matrix multiplication between two N*N matrices where the fastest changing index is ".x"
         * Each thread calculates one cell in the output matrix 
         * Parameters : M - matrix M stored as 1-D layout
         *            : N - matrix N stored as 1-D layout
         *            : P - matrix P which stores the multiplication of the matrices A and B
         *            : width - Number of rows/columns in the matrix as they are square matrices
         */
         int            col = blockIdx.x*blockDim.x+threadIdx.x; /* Column of the cell to be calculated */
         int            row = blockIdx.y*blockDim.y+threadIdx.y; /* Row of the cell to be calculated */
         double         pSum = 0.0 ; /* Variable to store the partial sum of each multiplication */

	 if( (row<width) && (col<width)){ /* Condition to check if the element to be calculated is within bounds */
         	for(unsigned i=0;i<width;i++){
                	pSum += M[row*width+i]*N[i*width+col];
         	}
	 }
         P[row*width+col] = pSum;	
}

int main(int argc,char **argv){
	if(argc!=1){
		printf("error: Invalid number of arguments\n");
		exit(EXIT_FAILURE);
	}

	/******************************* Variable Initialization  ********************************/

	double		*h_M; /* Matrix multiplicand on the host */
	double		*h_N; /* Matrix multiplicand on the host */
	double		*h_P; /* Matrix multiplication result  on the host */
	double		*d_M; /* Matrix multiplicand on the device */
	double		*d_N; /* Matrix multiplicand on the device */
	double		*d_P; /* Matrix multiplication result on the device */
	size_t		size; /* Size of each matrix in bytes */
	cudaEvent_t	start,stop; /* CUDA events to be used to calculate the kernel-run time */
	cudaEvent_t     start_1,stop_1; /* CUDA events to be used to calculate the kernel-run time */
	cudaEvent_t     start_2,stop_2; /* CUDA events to be used to calculate the kernel-run time */
	cudaEvent_t     start_3,stop_3; /* CUDA events to be used to calculate the kernel-run time */
	cudaEvent_t     start_4,stop_4; /* CUDA events to be used to calculate the kernel-run time */
	cudaEvent_t     start_5,stop_5; /* CUDA events to be used to calculate the kernel-run time */
	cudaEvent_t     start_6,stop_6; /* CUDA events to be used to calculate the kernel-run time */
	cudaEvent_t     start_7,stop_7; /* CUDA events to be used to calculate the kernel-run time */

	cudaEventCreate(&start);
	cudaEventCreate(&stop);
	cudaEventCreate(&start_1);
        cudaEventCreate(&stop_1);
	cudaEventCreate(&start_2);
        cudaEventCreate(&stop_2);
	cudaEventCreate(&start_3);
        cudaEventCreate(&stop_3);
	cudaEventCreate(&start_4);
        cudaEventCreate(&stop_4);
	cudaEventCreate(&start_5);
        cudaEventCreate(&stop_5);
	cudaEventCreate(&start_6);
        cudaEventCreate(&stop_6);
	cudaEventCreate(&start_7);
        cudaEventCreate(&stop_7);
	
	/*********************************** Allocate Memory on the Host *************************/

	size = sizeof(double)*SIZE*SIZE;

	h_M = (double *)malloc(size);
	h_N = (double *)malloc(size);
	h_P = (double *)malloc(size);

	/********************************* Initialize matrix with values ***********************/
	fill_matrix(h_M,SIZE,SIZE);
	fill_matrix(h_N,SIZE,SIZE);

	/******************************* Allocate Memory on the GPU ****************************/
	ERROR_HANDLER(cudaMalloc((void **)&d_M,size),__LINE__);
	ERROR_HANDLER(cudaMalloc((void **)&d_N,size),__LINE__);
	ERROR_HANDLER(cudaMalloc((void **)&d_P,size),__LINE__);

	/****************************** Copy multiplicands to the device ***********************/
	ERROR_HANDLER(cudaMemcpy(d_M,h_M,size,cudaMemcpyHostToDevice),__LINE__);
	ERROR_HANDLER(cudaMemcpy(d_N,h_N,size,cudaMemcpyHostToDevice),__LINE__);
	
	/****************************** Kernel Invocation **************************************/

	dim3	threads(NUM_THREADS_X,NUM_THREADS_Y);
	dim3	blocks((SIZE+NUM_THREADS_X-1)/NUM_THREADS_X,(SIZE+NUM_THREADS_Y-1)/NUM_THREADS_Y);
	float   milliseconds = 0.0;

	cudaEventRecord(start);	
	matrixMul<<<blocks,threads>>>(d_M,d_N,d_P,SIZE);
	cudaEventRecord(stop);

	ERROR_HANDLER(cudaMemcpy(h_P,d_P,size,cudaMemcpyDeviceToHost),__LINE__);
	print_matrix_to_file(h_P,SIZE,SIZE);

	dim3 threads_1(X_1,Y_1);
	dim3 blocks_1((SIZE+X_1-1)/X_1,(SIZE+Y_1-1)/Y_1);
	cudaEventRecord(start_1);
        matrixMul<<<blocks_1,threads_1>>>(d_M,d_N,d_P,SIZE);
        cudaEventRecord(stop_1);

	ERROR_HANDLER(cudaMemcpy(h_P,d_P,size,cudaMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);


	dim3 threads_2(X_2,Y_2);
        dim3 blocks_2((SIZE+X_2-1)/X_2,(SIZE+Y_2-1)/Y_2);
        cudaEventRecord(start_2);
        matrixMul<<<blocks_2,threads_2>>>(d_M,d_N,d_P,SIZE);
        cudaEventRecord(stop_2);

        ERROR_HANDLER(cudaMemcpy(h_P,d_P,size,cudaMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

 	dim3 threads_3(X_3,Y_3);
        dim3 blocks_3((SIZE+X_3-1)/X_3,(SIZE+Y_3-1)/Y_3);
        cudaEventRecord(start_3);
        matrixMul<<<blocks_3,threads_3>>>(d_M,d_N,d_P,SIZE);
        cudaEventRecord(stop_3);

        ERROR_HANDLER(cudaMemcpy(h_P,d_P,size,cudaMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

 	dim3 threads_4(X_4,Y_4);
        dim3 blocks_4((SIZE+X_4-1)/X_4,(SIZE+Y_4-1)/Y_4);
        cudaEventRecord(start_4);
        matrixMul<<<blocks_4,threads_4>>>(d_M,d_N,d_P,SIZE);
        cudaEventRecord(stop_4);

        ERROR_HANDLER(cudaMemcpy(h_P,d_P,size,cudaMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

 	dim3 threads_5(X_5,Y_5);
        dim3 blocks_5((SIZE+X_5-1)/X_5,(SIZE+Y_5-1)/Y_5);
        cudaEventRecord(start_5);
        matrixMul<<<blocks_5,threads_5>>>(d_M,d_N,d_P,SIZE);
        cudaEventRecord(stop_5);

        ERROR_HANDLER(cudaMemcpy(h_P,d_P,size,cudaMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

	dim3 threads_6(X_6,Y_6);
        dim3 blocks_6((SIZE+X_6-1)/X_6,(SIZE+Y_6-1)/Y_6);
        cudaEventRecord(start_6);
        matrixMul<<<blocks_6,threads_6>>>(d_M,d_N,d_P,SIZE);
        cudaEventRecord(stop_6);

        ERROR_HANDLER(cudaMemcpy(h_P,d_P,size,cudaMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

	dim3 threads_7(X_7,Y_7);
        dim3 blocks_7((SIZE+X_7-1)/X_7,(SIZE+Y_7-1)/Y_7);
        cudaEventRecord(start_7);
        matrixMul<<<blocks_7,threads_7>>>(d_M,d_N,d_P,SIZE);
        cudaEventRecord(stop_7);

        ERROR_HANDLER(cudaMemcpy(h_P,d_P,size,cudaMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

	cudaEventSynchronize(stop);

	cudaEventElapsedTime(&milliseconds,start_1,stop_1);
	printf("Run-Time(seconds) (4*4): %.10f\n",milliseconds/1000);
	cudaEventElapsedTime(&milliseconds,start_2,stop_2);
	printf("Run-Time(seconds) (4*8): %.10f\n",milliseconds/1000);
	cudaEventElapsedTime(&milliseconds,start_3,stop_3);
	printf("Run-Time(seconds) (8*4): %.10f\n",milliseconds/1000);
	cudaEventElapsedTime(&milliseconds,start_4,stop_4);
	printf("Run-Time(seconds) (8*8): %.10f\n",milliseconds/1000);
	cudaEventElapsedTime(&milliseconds,start_5,stop_5);
	printf("Run-Time(seconds) (8*16): %.10f\n",milliseconds/1000);
	cudaEventElapsedTime(&milliseconds,start_6,stop_6);
	printf("Run-Time(seconds) (16*8): %.10f\n",milliseconds/1000);
	cudaEventElapsedTime(&milliseconds,start,stop);
	printf("Run-Time(seconds) (16*16): %.10f\n",milliseconds/1000);
	cudaEventElapsedTime(&milliseconds,start_7,stop_7);
	printf("Run-Time(seconds) (16*32): %.10f\n",milliseconds/1000);

	/**************************** Free Allocated Memory **********************************/
	cudaFree(d_M);
	cudaFree(d_N);
	cudaFree(d_P);
	free(h_M);
	free(h_N);
	free(h_P);
}

	.file	"tmpxft_0031a8e7_00000000-6_ee16b105_2.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2033:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2033:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/anantshah200/CS6023/master/Assignment2/ee16b105_2.cu"
.LC1:
	.string	"%s in %s at %d"
	.text
	.globl	_Z13error_handler9cudaErrori
	.type	_Z13error_handler9cudaErrori, @function
_Z13error_handler9cudaErrori:
.LFB2027:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L2
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	%esi, 12(%rsp)
	call	cudaGetErrorString@PLT
	movl	12(%rsp), %r8d
	movl	$2, %edi
	leaq	.LC0(%rip), %rcx
	movq	%rax, %rdx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z13error_handler9cudaErrori, .-_Z13error_handler9cudaErrori
	.globl	_Z11fill_matrixPdjj
	.type	_Z11fill_matrixPdjj, @function
_Z11fill_matrixPdjj:
.LFB2028:
	.cfi_startproc
	endbr64
	movss	.LC2(%rip), %xmm2
	movss	.LC3(%rip), %xmm3
	movq	%rdi, %r8
	xorl	%ecx, %ecx
	xorl	%edi, %edi
.L9:
	cmpl	%esi, %ecx
	je	.L17
	xorl	%eax, %eax
	movl	%ecx, %r9d
.L15:
	cmpl	%edx, %eax
	je	.L18
	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	.L15
.L18:
	incl	%ecx
	addl	%edx, %edi
	jmp	.L9
.L17:
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z11fill_matrixPdjj, .-_Z11fill_matrixPdjj
	.section	.rodata.str1.1
.LC4:
	.string	"a"
.LC5:
	.string	"assignment2_out"
.LC6:
	.string	"%4.4f "
.LC7:
	.string	"\n"
	.text
	.globl	_Z20print_matrix_to_filePdjj
	.type	_Z20print_matrix_to_filePdjj, @function
_Z20print_matrix_to_filePdjj:
.LFB2029:
	.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	.LC5(%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	.LC4(%rip), %rsi
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	fopen@PLT
	movq	%rax, 8(%rsp)
.L20:
	cmpq	%rbx, %r12
	je	.L25
	movl	%r15d, %ebp
.L22:
	leal	(%r14,%r15), %eax
	cmpl	%eax, %ebp
	je	.L26
	movl	%ebp, %eax
	movq	8(%rsp), %rdi
	leaq	.LC6(%rip), %rdx
	incl	%ebp
	movsd	0(%r13,%rax,8), %xmm0
	movl	$2, %esi
	movb	$1, %al
	call	__fprintf_chk@PLT
	jmp	.L22
.L26:
	movq	8(%rsp), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	incq	%r12
	leaq	.LC7(%rip), %rdx
	movl	%ebp, %r15d
	call	__fprintf_chk@PLT
	jmp	.L20
.L25:
	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
.LFE2029:
	.size	_Z20print_matrix_to_filePdjj, .-_Z20print_matrix_to_filePdjj
	.globl	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
	.type	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i, @function
_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i:
.LFB2055:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L27
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z9matrixMulPdS_S_i(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L27:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i, .-_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
	.globl	_Z9matrixMulPdS_S_i
	.type	_Z9matrixMulPdS_S_i, @function
_Z9matrixMulPdS_S_i:
.LFB2056:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
	.cfi_endproc
.LFE2056:
	.size	_Z9matrixMulPdS_S_i, .-_Z9matrixMulPdS_S_i
	.section	.rodata.str1.1
.LC8:
	.string	"error: Invalid number of arguments\n"
.LC11:
	.string	"Run-Time(seconds) (4*4): %.10f\n"
.LC12:
	.string	"Run-Time(seconds) (4*8): %.10f\n"
.LC13:
	.string	"Run-Time(seconds) (8*4): %.10f\n"
.LC14:
	.string	"Run-Time(seconds) (8*8): %.10f\n"
.LC15:
	.string	"Run-Time(seconds) (8*16): %.10f\n"
.LC16:
	.string	"Run-Time(seconds) (16*8): %.10f\n"
.LC17:
	.string	"Run-Time(seconds) (16*16): %.10f\n"
.LC18:
	.string	"Run-Time(seconds) (16*32): %.10f\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$376, %rsp
	.cfi_def_cfa_offset 416
	movq	%fs:40, %rax
	movq	%rax, 360(%rsp)
	xorl	%eax, %eax
	decl	%edi
	je	.L33
	movl	$2, %edi
	leaq	.LC8(%rip), %rsi
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L33:
	leaq	40(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	48(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	56(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	64(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	72(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	80(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	88(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	96(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	104(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	112(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	120(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	128(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	136(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	144(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	152(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	160(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$536870912, %edi
	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, %rbx
	call	_Z11fill_matrixPdjj
	movq	%r12, %rdi
	call	_Z11fill_matrixPdjj
	leaq	16(%rsp), %rdi
	movl	$536870912, %esi
	call	cudaMalloc@PLT
	movl	$133, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	leaq	24(%rsp), %rdi
	movl	$536870912, %esi
	call	cudaMalloc@PLT
	movl	$134, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	leaq	32(%rsp), %rdi
	movl	$536870912, %esi
	call	cudaMalloc@PLT
	movl	$135, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rsi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movl	$138, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movq	%r12, %rsi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movl	$139, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	movabsq	$68719476752, %rax
	movq	%rax, 168(%rsp)
	movabsq	$2199023256064, %rax
	movl	$1, 176(%rsp)
	movq	%rax, 180(%rsp)
	movl	$1, 188(%rsp)
	movl	$0x00000000, 12(%rsp)
	call	cudaEventRecord@PLT
	movl	176(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	168(%rsp), %rdx
	movq	180(%rsp), %rdi
	movl	188(%rsp), %esi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L34
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movl	$8192, %ecx
	movq	16(%rsp), %rdi
	call	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
.L34:
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movl	$151, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%rbx, %rdi
	call	_Z20print_matrix_to_filePdjj
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	movabsq	$17179869188, %rax
	movq	%rax, 192(%rsp)
	movabsq	$8796093024256, %rax
	movl	$1, 200(%rsp)
	movq	%rax, 204(%rsp)
	movl	$1, 212(%rsp)
	call	cudaEventRecord@PLT
	movl	200(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	192(%rsp), %rdx
	movq	204(%rsp), %rdi
	movl	212(%rsp), %esi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L35
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movl	$8192, %ecx
	movq	16(%rsp), %rdi
	call	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
.L35:
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movl	$160, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%rbx, %rdi
	call	_Z20print_matrix_to_filePdjj
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	movabsq	$34359738372, %rax
	movq	%rax, 216(%rsp)
	movl	$2147483649, %eax
	movl	$1, 224(%rsp)
	salq	$11, %rax
	movq	%rax, 228(%rsp)
	movl	$1, 236(%rsp)
	call	cudaEventRecord@PLT
	movl	224(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	216(%rsp), %rdx
	movq	228(%rsp), %rdi
	movl	236(%rsp), %esi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L36
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movl	$8192, %ecx
	movq	16(%rsp), %rdi
	call	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
.L36:
	movq	80(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movl	$170, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%rbx, %rdi
	call	_Z20print_matrix_to_filePdjj
	movl	$2147483649, %eax
	movq	88(%rsp), %rdi
	xorl	%esi, %esi
	movl	$1, 248(%rsp)
	salq	$3, %rax
	movq	%rax, 240(%rsp)
	movabsq	$8796093023232, %rax
	movq	%rax, 252(%rsp)
	movl	$1, 260(%rsp)
	call	cudaEventRecord@PLT
	movl	248(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	240(%rsp), %rdx
	movq	252(%rsp), %rdi
	movl	260(%rsp), %esi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L37
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movl	$8192, %ecx
	movq	16(%rsp), %rdi
	call	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
.L37:
	movq	96(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movl	$179, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%rbx, %rdi
	call	_Z20print_matrix_to_filePdjj
	movq	104(%rsp), %rdi
	xorl	%esi, %esi
	movabsq	$34359738376, %rax
	movq	%rax, 264(%rsp)
	movabsq	$4398046512128, %rax
	movl	$1, 272(%rsp)
	movq	%rax, 276(%rsp)
	movl	$1, 284(%rsp)
	call	cudaEventRecord@PLT
	movl	272(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	264(%rsp), %rdx
	movq	276(%rsp), %rdi
	movl	284(%rsp), %esi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L38
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movl	$8192, %ecx
	movq	16(%rsp), %rdi
	call	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
.L38:
	movq	112(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movl	$188, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%rbx, %rdi
	call	_Z20print_matrix_to_filePdjj
	movq	120(%rsp), %rdi
	xorl	%esi, %esi
	movabsq	$68719476744, %rax
	movq	%rax, 288(%rsp)
	movl	$2147483649, %eax
	movl	$1, 296(%rsp)
	salq	$10, %rax
	movq	%rax, 300(%rsp)
	movl	$1, 308(%rsp)
	call	cudaEventRecord@PLT
	movl	296(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	288(%rsp), %rdx
	movq	300(%rsp), %rdi
	movl	308(%rsp), %esi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L39
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movl	$8192, %ecx
	movq	16(%rsp), %rdi
	call	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
.L39:
	movq	128(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movl	$197, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%rbx, %rdi
	call	_Z20print_matrix_to_filePdjj
	movl	$2147483649, %eax
	movq	136(%rsp), %rdi
	xorl	%esi, %esi
	movl	$1, 320(%rsp)
	salq	$4, %rax
	movq	%rax, 312(%rsp)
	movabsq	$4398046511616, %rax
	movq	%rax, 324(%rsp)
	movl	$1, 332(%rsp)
	call	cudaEventRecord@PLT
	movl	320(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	312(%rsp), %rdx
	movq	324(%rsp), %rdi
	movl	332(%rsp), %esi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L40
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movl	$8192, %ecx
	movq	16(%rsp), %rdi
	call	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
.L40:
	movq	144(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movl	$206, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%rbx, %rdi
	call	_Z20print_matrix_to_filePdjj
	movq	152(%rsp), %rdi
	xorl	%esi, %esi
	movabsq	$137438953488, %rax
	movq	%rax, 336(%rsp)
	movl	$2147483649, %eax
	movl	$1, 344(%rsp)
	salq	$9, %rax
	movq	%rax, 348(%rsp)
	movl	$1, 356(%rsp)
	call	cudaEventRecord@PLT
	movl	344(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	336(%rsp), %rdx
	movq	348(%rsp), %rdi
	movl	356(%rsp), %esi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L41
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	movl	$8192, %ecx
	movq	16(%rsp), %rdi
	call	_Z33__device_stub__Z9matrixMulPdS_S_iPdS_S_i
.L41:
	movq	160(%rsp), %rdi
	xorl	%esi, %esi
	leaq	12(%rsp), %rbp
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$536870912, %edx
	call	cudaMemcpy@PLT
	movl	$215, %esi
	movl	%eax, %edi
	call	_Z13error_handler9cudaErrori
	movl	$8192, %edx
	movl	$8192, %esi
	movq	%rbx, %rdi
	call	_Z20print_matrix_to_filePdjj
	movq	48(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	64(%rsp), %rdx
	movq	56(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	12(%rsp), %xmm0
	divss	.LC10(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	80(%rsp), %rdx
	movq	72(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	12(%rsp), %xmm0
	divss	.LC10(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	96(%rsp), %rdx
	movq	88(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	12(%rsp), %xmm0
	divss	.LC10(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	112(%rsp), %rdx
	movq	104(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	12(%rsp), %xmm0
	divss	.LC10(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	128(%rsp), %rdx
	movq	120(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	12(%rsp), %xmm0
	divss	.LC10(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	144(%rsp), %rdx
	movq	136(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	12(%rsp), %xmm0
	divss	.LC10(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC17(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	12(%rsp), %xmm0
	divss	.LC10(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	160(%rsp), %rdx
	movq	152(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC18(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	12(%rsp), %xmm0
	divss	.LC10(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	360(%rsp), %rax
	subq	%fs:40, %rax
	je	.L42
	call	__stack_chk_fail@PLT
.L42:
	addq	$376, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	main, .-main
	.section	.rodata.str1.1
.LC19:
	.string	"_Z9matrixMulPdS_S_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2058:
	.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	.LC19(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z9matrixMulPdS_S_i(%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
.LFE2058:
	.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
.LC2:
	.long	1074161254
	.align 4
.LC3:
	.long	1078774989
	.align 4
.LC10:
	.long	1148846080
	.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:

/* Program : To find the run-time for the matrix multiplication kernel without tiling for various block sizes
 * Author : Anant Shah
 * Date : 13-9-2018
 * Roll Number : EE16B105
 **/


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

#define ERROR_HANDLER(error_msg,line) error_handler(error_msg,line)
#define NUM_THREADS_X 16
#define NUM_THREADS_Y 16
#define X_1 4
#define Y_1 4
#define X_2 4
#define Y_2 8
#define X_3 8
#define Y_3 4
#define X_4 8
#define Y_4 8
#define X_5 8
#define Y_5 16
#define X_6 16
#define Y_6 8
#define X_7 16
#define Y_7 32
#define SIZE 8192

void error_handler(hipError_t error_msg,int line){
	/* Function to check if a CUDA statement resulted in a function */
	if(error_msg!=hipSuccess){
		printf("%s in %s at %d",hipGetErrorString(error_msg),__FILE__,line);
		exit(EXIT_FAILURE);
	}
}

void fill_matrix(double *mat,unsigned numRows,unsigned numCols){
	/* Function to fill a mtrix with values */
	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){
	/* Function to wite a matrix into a file */
	const char 	*fname = "assignment2_out";
	FILE		*f = fopen(fname,"a");

	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 matrixMul(double *M,double *N,double *P,int width){
	/* Kernel to perform the matrix multiplication between two N*N matrices where the fastest changing index is ".x"
         * Each thread calculates one cell in the output matrix 
         * Parameters : M - matrix M stored as 1-D layout
         *            : N - matrix N stored as 1-D layout
         *            : P - matrix P which stores the multiplication of the matrices A and B
         *            : width - Number of rows/columns in the matrix as they are square matrices
         */
         int            col = blockIdx.x*blockDim.x+threadIdx.x; /* Column of the cell to be calculated */
         int            row = blockIdx.y*blockDim.y+threadIdx.y; /* Row of the cell to be calculated */
         double         pSum = 0.0 ; /* Variable to store the partial sum of each multiplication */

	 if( (row<width) && (col<width)){ /* Condition to check if the element to be calculated is within bounds */
         	for(unsigned i=0;i<width;i++){
                	pSum += M[row*width+i]*N[i*width+col];
         	}
	 }
         P[row*width+col] = pSum;	
}

int main(int argc,char **argv){
	if(argc!=1){
		printf("error: Invalid number of arguments\n");
		exit(EXIT_FAILURE);
	}

	/******************************* Variable Initialization  ********************************/

	double		*h_M; /* Matrix multiplicand on the host */
	double		*h_N; /* Matrix multiplicand on the host */
	double		*h_P; /* Matrix multiplication result  on the host */
	double		*d_M; /* Matrix multiplicand on the device */
	double		*d_N; /* Matrix multiplicand on the device */
	double		*d_P; /* Matrix multiplication result on the device */
	size_t		size; /* Size of each matrix in bytes */
	hipEvent_t	start,stop; /* CUDA events to be used to calculate the kernel-run time */
	hipEvent_t     start_1,stop_1; /* CUDA events to be used to calculate the kernel-run time */
	hipEvent_t     start_2,stop_2; /* CUDA events to be used to calculate the kernel-run time */
	hipEvent_t     start_3,stop_3; /* CUDA events to be used to calculate the kernel-run time */
	hipEvent_t     start_4,stop_4; /* CUDA events to be used to calculate the kernel-run time */
	hipEvent_t     start_5,stop_5; /* CUDA events to be used to calculate the kernel-run time */
	hipEvent_t     start_6,stop_6; /* CUDA events to be used to calculate the kernel-run time */
	hipEvent_t     start_7,stop_7; /* CUDA events to be used to calculate the kernel-run time */

	hipEventCreate(&start);
	hipEventCreate(&stop);
	hipEventCreate(&start_1);
        hipEventCreate(&stop_1);
	hipEventCreate(&start_2);
        hipEventCreate(&stop_2);
	hipEventCreate(&start_3);
        hipEventCreate(&stop_3);
	hipEventCreate(&start_4);
        hipEventCreate(&stop_4);
	hipEventCreate(&start_5);
        hipEventCreate(&stop_5);
	hipEventCreate(&start_6);
        hipEventCreate(&stop_6);
	hipEventCreate(&start_7);
        hipEventCreate(&stop_7);
	
	/*********************************** Allocate Memory on the Host *************************/

	size = sizeof(double)*SIZE*SIZE;

	h_M = (double *)malloc(size);
	h_N = (double *)malloc(size);
	h_P = (double *)malloc(size);

	/********************************* Initialize matrix with values ***********************/
	fill_matrix(h_M,SIZE,SIZE);
	fill_matrix(h_N,SIZE,SIZE);

	/******************************* Allocate Memory on the GPU ****************************/
	ERROR_HANDLER(hipMalloc((void **)&d_M,size),__LINE__);
	ERROR_HANDLER(hipMalloc((void **)&d_N,size),__LINE__);
	ERROR_HANDLER(hipMalloc((void **)&d_P,size),__LINE__);

	/****************************** Copy multiplicands to the device ***********************/
	ERROR_HANDLER(hipMemcpy(d_M,h_M,size,hipMemcpyHostToDevice),__LINE__);
	ERROR_HANDLER(hipMemcpy(d_N,h_N,size,hipMemcpyHostToDevice),__LINE__);
	
	/****************************** Kernel Invocation **************************************/

	dim3	threads(NUM_THREADS_X,NUM_THREADS_Y);
	dim3	blocks((SIZE+NUM_THREADS_X-1)/NUM_THREADS_X,(SIZE+NUM_THREADS_Y-1)/NUM_THREADS_Y);
	float   milliseconds = 0.0;

	hipEventRecord(start);	
	matrixMul<<<blocks,threads>>>(d_M,d_N,d_P,SIZE);
	hipEventRecord(stop);

	ERROR_HANDLER(hipMemcpy(h_P,d_P,size,hipMemcpyDeviceToHost),__LINE__);
	print_matrix_to_file(h_P,SIZE,SIZE);

	dim3 threads_1(X_1,Y_1);
	dim3 blocks_1((SIZE+X_1-1)/X_1,(SIZE+Y_1-1)/Y_1);
	hipEventRecord(start_1);
        matrixMul<<<blocks_1,threads_1>>>(d_M,d_N,d_P,SIZE);
        hipEventRecord(stop_1);

	ERROR_HANDLER(hipMemcpy(h_P,d_P,size,hipMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);


	dim3 threads_2(X_2,Y_2);
        dim3 blocks_2((SIZE+X_2-1)/X_2,(SIZE+Y_2-1)/Y_2);
        hipEventRecord(start_2);
        matrixMul<<<blocks_2,threads_2>>>(d_M,d_N,d_P,SIZE);
        hipEventRecord(stop_2);

        ERROR_HANDLER(hipMemcpy(h_P,d_P,size,hipMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

 	dim3 threads_3(X_3,Y_3);
        dim3 blocks_3((SIZE+X_3-1)/X_3,(SIZE+Y_3-1)/Y_3);
        hipEventRecord(start_3);
        matrixMul<<<blocks_3,threads_3>>>(d_M,d_N,d_P,SIZE);
        hipEventRecord(stop_3);

        ERROR_HANDLER(hipMemcpy(h_P,d_P,size,hipMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

 	dim3 threads_4(X_4,Y_4);
        dim3 blocks_4((SIZE+X_4-1)/X_4,(SIZE+Y_4-1)/Y_4);
        hipEventRecord(start_4);
        matrixMul<<<blocks_4,threads_4>>>(d_M,d_N,d_P,SIZE);
        hipEventRecord(stop_4);

        ERROR_HANDLER(hipMemcpy(h_P,d_P,size,hipMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

 	dim3 threads_5(X_5,Y_5);
        dim3 blocks_5((SIZE+X_5-1)/X_5,(SIZE+Y_5-1)/Y_5);
        hipEventRecord(start_5);
        matrixMul<<<blocks_5,threads_5>>>(d_M,d_N,d_P,SIZE);
        hipEventRecord(stop_5);

        ERROR_HANDLER(hipMemcpy(h_P,d_P,size,hipMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

	dim3 threads_6(X_6,Y_6);
        dim3 blocks_6((SIZE+X_6-1)/X_6,(SIZE+Y_6-1)/Y_6);
        hipEventRecord(start_6);
        matrixMul<<<blocks_6,threads_6>>>(d_M,d_N,d_P,SIZE);
        hipEventRecord(stop_6);

        ERROR_HANDLER(hipMemcpy(h_P,d_P,size,hipMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

	dim3 threads_7(X_7,Y_7);
        dim3 blocks_7((SIZE+X_7-1)/X_7,(SIZE+Y_7-1)/Y_7);
        hipEventRecord(start_7);
        matrixMul<<<blocks_7,threads_7>>>(d_M,d_N,d_P,SIZE);
        hipEventRecord(stop_7);

        ERROR_HANDLER(hipMemcpy(h_P,d_P,size,hipMemcpyDeviceToHost),__LINE__);
        print_matrix_to_file(h_P,SIZE,SIZE);

	hipEventSynchronize(stop);

	hipEventElapsedTime(&milliseconds,start_1,stop_1);
	printf("Run-Time(seconds) (4*4): %.10f\n",milliseconds/1000);
	hipEventElapsedTime(&milliseconds,start_2,stop_2);
	printf("Run-Time(seconds) (4*8): %.10f\n",milliseconds/1000);
	hipEventElapsedTime(&milliseconds,start_3,stop_3);
	printf("Run-Time(seconds) (8*4): %.10f\n",milliseconds/1000);
	hipEventElapsedTime(&milliseconds,start_4,stop_4);
	printf("Run-Time(seconds) (8*8): %.10f\n",milliseconds/1000);
	hipEventElapsedTime(&milliseconds,start_5,stop_5);
	printf("Run-Time(seconds) (8*16): %.10f\n",milliseconds/1000);
	hipEventElapsedTime(&milliseconds,start_6,stop_6);
	printf("Run-Time(seconds) (16*8): %.10f\n",milliseconds/1000);
	hipEventElapsedTime(&milliseconds,start,stop);
	printf("Run-Time(seconds) (16*16): %.10f\n",milliseconds/1000);
	hipEventElapsedTime(&milliseconds,start_7,stop_7);
	printf("Run-Time(seconds) (16*32): %.10f\n",milliseconds/1000);

	/**************************** Free Allocated Memory **********************************/
	hipFree(d_M);
	hipFree(d_N);
	hipFree(d_P);
	free(h_M);
	free(h_N);
	free(h_P);
}

	.text
	.file	"ee16b105_2.hip"
	.globl	_Z13error_handler10hipError_ti  # -- Begin function _Z13error_handler10hipError_ti
	.type	_Z13error_handler10hipError_ti,@function
_Z13error_handler10hipError_ti:         # @_Z13error_handler10hipError_ti
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB0_2
# %bb.1:
	retq
.LBB0_2:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	%esi, %ebx
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movl	$.L.str.1, %edx
	movq	%rax, %rsi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end0:
	.size	_Z13error_handler10hipError_ti, .Lfunc_end0-_Z13error_handler10hipError_ti
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z11fill_matrixPdjj
.LCPI1_0:
	.long	0x40066666                      # float 2.0999999
.LCPI1_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	.LBB1_6
# %bb.1:                                # %.preheader.lr.ph
	movl	%edx, %eax
	xorl	%ecx, %ecx
	movss	.LCPI1_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movss	.LCPI1_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	xorl	%r8d, %r8d
.LBB1_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_4 Depth 2
	testl	%edx, %edx
	je	.LBB1_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB1_2 Depth=1
	movl	%r8d, %r9d
	xorps	%xmm2, %xmm2
	cvtsi2ss	%r9, %xmm2
	mulss	%xmm0, %xmm2
	xorl	%r9d, %r9d
.LBB1_4:                                #   Parent Loop BB1_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	.LBB1_4
.LBB1_5:                                # %._crit_edge
                                        #   in Loop: Header=BB1_2 Depth=1
	incl	%r8d
	addq	%rax, %rcx
	cmpl	%esi, %r8d
	jne	.LBB1_2
.LBB1_6:                                # %._crit_edge15
	retq
.Lfunc_end1:
	.size	_Z11fill_matrixPdjj, .Lfunc_end1-_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.2, %edi
	movl	$.L.str.3, %esi
	callq	fopen
	movq	%rax, %r15
	movl	%ebp, 12(%rsp)                  # 4-byte Spill
	testl	%ebp, %ebp
	je	.LBB2_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
.LBB2_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_5 Depth 2
	movq	16(%rsp), %r12                  # 8-byte Reload
	movl	%ebx, %r13d
	testl	%ecx, %ecx
	je	.LBB2_3
.LBB2_5:                                #   Parent Loop BB2_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%r13d, %eax
	movsd	(%r14,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str.4, %esi
	movq	%r15, %rdi
	movb	$1, %al
	callq	fprintf
	incl	%r13d
	decq	%r12
	jne	.LBB2_5
.LBB2_3:                                # %._crit_edge
                                        #   in Loop: Header=BB2_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	.LBB2_2
.LBB2_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_end2:
	.size	_Z20print_matrix_to_filePdjj, .Lfunc_end2-_Z20print_matrix_to_filePdjj
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__matrixMulPdS_S_i # -- Begin function _Z24__device_stub__matrixMulPdS_S_i
	.type	_Z24__device_stub__matrixMulPdS_S_i,@function
_Z24__device_stub__matrixMulPdS_S_i:    # @_Z24__device_stub__matrixMulPdS_S_i
	.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	$112, %rsp
	.cfi_def_cfa_offset 160
	.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)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%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	$_Z9matrixMulPdS_S_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	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_end3:
	.size	_Z24__device_stub__matrixMulPdS_S_i, .Lfunc_end3-_Z24__device_stub__matrixMulPdS_S_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI4_0:
	.long	0x40066666                      # float 2.0999999
.LCPI4_1:
	.long	0x404ccccd                      # float 3.20000005
.LCPI4_2:
	.long	0x447a0000                      # float 1000
	.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	$184, %rsp
	.cfi_def_cfa_offset 240
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	cmpl	$1, %edi
	jne	.LBB4_26
# %bb.1:
	leaq	160(%rsp), %rdi
	callq	hipEventCreate
	leaq	32(%rsp), %rdi
	callq	hipEventCreate
	leaq	152(%rsp), %rdi
	callq	hipEventCreate
	leaq	144(%rsp), %rdi
	callq	hipEventCreate
	leaq	136(%rsp), %rdi
	callq	hipEventCreate
	leaq	128(%rsp), %rdi
	callq	hipEventCreate
	leaq	120(%rsp), %rdi
	callq	hipEventCreate
	leaq	112(%rsp), %rdi
	callq	hipEventCreate
	leaq	104(%rsp), %rdi
	callq	hipEventCreate
	leaq	96(%rsp), %rdi
	callq	hipEventCreate
	leaq	88(%rsp), %rdi
	callq	hipEventCreate
	leaq	80(%rsp), %rdi
	callq	hipEventCreate
	leaq	72(%rsp), %rdi
	callq	hipEventCreate
	leaq	64(%rsp), %rdi
	callq	hipEventCreate
	leaq	56(%rsp), %rdi
	callq	hipEventCreate
	leaq	48(%rsp), %rdi
	callq	hipEventCreate
	movl	$536870912, %edi                # imm = 0x20000000
	callq	malloc
	movq	%rax, %r12
	movl	$536870912, %edi                # imm = 0x20000000
	callq	malloc
	movq	%rax, %rbp
	movl	$536870912, %edi                # imm = 0x20000000
	callq	malloc
	movq	%rax, %r15
	xorl	%eax, %eax
	movss	.LCPI4_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movss	.LCPI4_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	movq	%r12, %rcx
.LBB4_2:                                # %.preheader.i
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_3 Depth 2
	movl	%eax, %edx
	xorps	%xmm2, %xmm2
	cvtsi2ss	%rdx, %xmm2
	mulss	%xmm0, %xmm2
	xorl	%edx, %edx
.LBB4_3:                                #   Parent Loop BB4_2 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	.LBB4_3
# %bb.4:                                # %._crit_edge.i
                                        #   in Loop: Header=BB4_2 Depth=1
	incl	%eax
	addq	$65536, %rcx                    # imm = 0x10000
	cmpl	$8192, %eax                     # imm = 0x2000
	jne	.LBB4_2
# %bb.5:                                # %.preheader.i110.preheader
	xorl	%eax, %eax
	movq	%rbp, %rcx
.LBB4_6:                                # %.preheader.i110
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_7 Depth 2
	movl	%eax, %edx
	xorps	%xmm2, %xmm2
	cvtsi2ss	%rdx, %xmm2
	mulss	%xmm0, %xmm2
	xorl	%edx, %edx
.LBB4_7:                                #   Parent Loop BB4_6 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	.LBB4_7
# %bb.8:                                # %._crit_edge.i115
                                        #   in Loop: Header=BB4_6 Depth=1
	incl	%eax
	addq	$65536, %rcx                    # imm = 0x10000
	cmpl	$8192, %eax                     # imm = 0x2000
	jne	.LBB4_6
# %bb.9:                                # %_Z11fill_matrixPdjj.exit117
	movabsq	$68719476744, %r13              # imm = 0x1000000008
	leaq	24(%rsp), %r14
	movl	$536870912, %esi                # imm = 0x20000000
	movq	%r14, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$135, %esi
	callq	_Z13error_handler10hipError_ti
	leaq	16(%rsp), %rbx
	movl	$536870912, %esi                # imm = 0x20000000
	movq	%rbx, %rdi
	callq	hipMalloc
	movl	%eax, %edi
	movl	$136, %esi
	callq	_Z13error_handler10hipError_ti
	leaq	8(%rsp), %rdi
	movl	$536870912, %esi                # imm = 0x20000000
	callq	hipMalloc
	movl	%eax, %edi
	movl	$137, %esi
	callq	_Z13error_handler10hipError_ti
	movq	(%r14), %rdi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%r12, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$140, %esi
	callq	_Z13error_handler10hipError_ti
	movq	(%rbx), %rdi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%rbp, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$141, %esi
	callq	_Z13error_handler10hipError_ti
	movl	$0, 44(%rsp)
	movq	160(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	leaq	8(%r13), %rdx
	movabsq	$2199023256064, %r13            # imm = 0x20000000200
	movq	%r13, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_11
# %bb.10:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	$8192, %ecx                     # imm = 0x2000
	callq	_Z24__device_stub__matrixMulPdS_S_i
.LBB4_11:
	movq	%rbp, 168(%rsp)                 # 8-byte Spill
	movq	%r12, 176(%rsp)                 # 8-byte Spill
	movabsq	$8796093023232, %r14            # imm = 0x80000000400
	movabsq	$17179869188, %rbx              # imm = 0x400000004
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$153, %esi
	callq	_Z13error_handler10hipError_ti
	movq	%r15, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movl	$8192, %edx                     # imm = 0x2000
	callq	_Z20print_matrix_to_filePdjj
	movq	152(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	leaq	1024(%r14), %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_13
# %bb.12:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	$8192, %ecx                     # imm = 0x2000
	callq	_Z24__device_stub__matrixMulPdS_S_i
.LBB4_13:
	movabsq	$4398046511616, %r12            # imm = 0x40000000200
	movabsq	$34359738372, %rbp              # imm = 0x800000004
	movq	144(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$162, %esi
	callq	_Z13error_handler10hipError_ti
	movq	%r15, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movl	$8192, %edx                     # imm = 0x2000
	callq	_Z20print_matrix_to_filePdjj
	movq	136(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	leaq	1536(%r12), %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_15
# %bb.14:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	$8192, %ecx                     # imm = 0x2000
	callq	_Z24__device_stub__matrixMulPdS_S_i
.LBB4_15:
	movq	128(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$172, %esi
	callq	_Z13error_handler10hipError_ti
	movq	%r15, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movl	$8192, %edx                     # imm = 0x2000
	callq	_Z20print_matrix_to_filePdjj
	movq	120(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	addq	$4, %rbx
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_17
# %bb.16:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	$8192, %ecx                     # imm = 0x2000
	callq	_Z24__device_stub__matrixMulPdS_S_i
.LBB4_17:
	movq	112(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$181, %esi
	callq	_Z13error_handler10hipError_ti
	movq	%r15, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movl	$8192, %edx                     # imm = 0x2000
	callq	_Z20print_matrix_to_filePdjj
	movq	104(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	leaq	4(%rbp), %rdx
	leaq	512(%r12), %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_19
# %bb.18:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	$8192, %ecx                     # imm = 0x2000
	callq	_Z24__device_stub__matrixMulPdS_S_i
.LBB4_19:
	movq	96(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$190, %esi
	callq	_Z13error_handler10hipError_ti
	movq	%r15, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movl	$8192, %edx                     # imm = 0x2000
	callq	_Z20print_matrix_to_filePdjj
	movq	88(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	addq	$512, %r13                      # imm = 0x200
	movq	%r13, %rdi
	movl	$1, %esi
	movabsq	$68719476744, %rdx              # imm = 0x1000000008
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_21
# %bb.20:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	$8192, %ecx                     # imm = 0x2000
	callq	_Z24__device_stub__matrixMulPdS_S_i
.LBB4_21:
	movq	80(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$199, %esi
	callq	_Z13error_handler10hipError_ti
	movq	%r15, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movl	$8192, %edx                     # imm = 0x2000
	callq	_Z20print_matrix_to_filePdjj
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	addq	$12, %rbp
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_23
# %bb.22:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	$8192, %ecx                     # imm = 0x2000
	callq	_Z24__device_stub__matrixMulPdS_S_i
.LBB4_23:
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$208, %esi
	callq	_Z13error_handler10hipError_ti
	movq	%r15, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movl	$8192, %edx                     # imm = 0x2000
	callq	_Z20print_matrix_to_filePdjj
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movabsq	$1099511628288, %rdi            # imm = 0x10000000200
	movabsq	$137438953488, %rdx             # imm = 0x2000000010
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	movq	176(%rsp), %r14                 # 8-byte Reload
	movq	168(%rsp), %r12                 # 8-byte Reload
	jne	.LBB4_25
# %bb.24:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	$8192, %ecx                     # imm = 0x2000
	callq	_Z24__device_stub__matrixMulPdS_S_i
.LBB4_25:
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rsi
	movl	$536870912, %edx                # imm = 0x20000000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	movl	$217, %esi
	callq	_Z13error_handler10hipError_ti
	movq	%r15, %rdi
	movl	$8192, %esi                     # imm = 0x2000
	movl	$8192, %edx                     # imm = 0x2000
	callq	_Z20print_matrix_to_filePdjj
	movq	32(%rsp), %rdi
	callq	hipEventSynchronize
	movq	152(%rsp), %rsi
	movq	144(%rsp), %rdx
	leaq	44(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI4_2(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.7, %edi
	movb	$1, %al
	callq	printf
	movq	136(%rsp), %rsi
	movq	128(%rsp), %rdx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI4_2(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.8, %edi
	movb	$1, %al
	callq	printf
	movq	120(%rsp), %rsi
	movq	112(%rsp), %rdx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI4_2(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.9, %edi
	movb	$1, %al
	callq	printf
	movq	104(%rsp), %rsi
	movq	96(%rsp), %rdx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI4_2(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.10, %edi
	movb	$1, %al
	callq	printf
	movq	88(%rsp), %rsi
	movq	80(%rsp), %rdx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI4_2(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.11, %edi
	movb	$1, %al
	callq	printf
	movq	72(%rsp), %rsi
	movq	64(%rsp), %rdx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI4_2(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.12, %edi
	movb	$1, %al
	callq	printf
	movq	160(%rsp), %rsi
	movq	32(%rsp), %rdx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI4_2(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.13, %edi
	movb	$1, %al
	callq	printf
	movq	56(%rsp), %rsi
	movq	48(%rsp), %rdx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI4_2(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.14, %edi
	movb	$1, %al
	callq	printf
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	%r14, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$184, %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
.LBB4_26:
	.cfi_def_cfa_offset 240
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end4:
	.size	main, .Lfunc_end4-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	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9matrixMulPdS_S_i, %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_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__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	.LBB6_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
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%s in %s at %d"
	.size	.L.str, 15

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/anantshah200/CS6023/master/Assignment2/ee16b105_2.hip"
	.size	.L.str.1, 116

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"assignment2_out"
	.size	.L.str.2, 16

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"a"
	.size	.L.str.3, 2

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

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

	.type	.L.str.7,@object                # @.str.7
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.7:
	.asciz	"Run-Time(seconds) (4*4): %.10f\n"
	.size	.L.str.7, 32

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Run-Time(seconds) (4*8): %.10f\n"
	.size	.L.str.8, 32

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Run-Time(seconds) (8*4): %.10f\n"
	.size	.L.str.9, 32

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Run-Time(seconds) (8*8): %.10f\n"
	.size	.L.str.10, 32

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Run-Time(seconds) (8*16): %.10f\n"
	.size	.L.str.11, 33

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Run-Time(seconds) (16*8): %.10f\n"
	.size	.L.str.12, 33

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Run-Time(seconds) (16*16): %.10f\n"
	.size	.L.str.13, 34

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Run-Time(seconds) (16*32): %.10f\n"
	.size	.L.str.14, 34

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9matrixMulPdS_S_i"
	.size	.L__unnamed_1, 20

	.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	"error: Invalid number of arguments"
	.size	.Lstr, 35

	.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 _Z24__device_stub__matrixMulPdS_S_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z9matrixMulPdS_S_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9matrixMulPdS_S_i     ; -- Begin function _Z9matrixMulPdS_S_i
	.globl	_Z9matrixMulPdS_S_i
	.p2align	8
	.type	_Z9matrixMulPdS_S_i,@function
_Z9matrixMulPdS_S_i:                    ; @_Z9matrixMulPdS_S_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s3, s[0:1], 0x2c
	s_load_b32 s2, s[0:1], 0x18
	v_and_b32_e32 v2, 0x3ff, v0
	v_bfe_u32 v3, v0, 10, 10
	s_mov_b32 s8, 0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s4, s3, 16
	s_and_b32 s3, s3, 0xffff
	s_cmp_lg_u32 s2, 0
	v_mad_u64_u32 v[0:1], null, s14, s3, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s4, v[3:4]
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	s_cselect_b32 s3, -1, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_max_i32_e32 v2, v0, v1
	v_mul_lo_u32 v7, v1, s2
	v_cmp_gt_i32_e32 vcc_lo, s2, v2
	v_mov_b32_e32 v1, 0
	v_mov_b32_e32 v2, 0
	s_and_b32 s9, vcc_lo, s3
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s3, s9
	s_cbranch_execz .LBB0_3
; %bb.1:                                ; %.lr.ph.preheader
	v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v4, 0
	v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v5, v0
.LBB0_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_dual_mov_b32 v6, v4 :: v_dual_add_nc_u32 v3, s8, v7
	s_add_i32 s8, s8, 1
	s_cmp_lg_u32 s2, s8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[8:9], 3, v[3:4]
	v_lshlrev_b64 v[10:11], 3, v[5:6]
	v_add_nc_u32_e32 v5, s2, v5
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v8, vcc_lo, s4, v8
	v_add_co_ci_u32_e32 v9, vcc_lo, s5, v9, vcc_lo
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_u32 v10, vcc_lo, s6, v10
	v_add_co_ci_u32_e32 v11, vcc_lo, s7, v11, vcc_lo
	global_load_b64 v[8:9], v[8:9], off
	global_load_b64 v[10:11], v[10:11], off
	s_waitcnt vmcnt(0)
	v_fma_f64 v[1:2], v[8:9], v[10:11], v[1:2]
	s_cbranch_scc1 .LBB0_2
.LBB0_3:                                ; %Flow43
	s_or_b32 exec_lo, exec_lo, s3
	v_add_nc_u32_e32 v3, v7, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[3:4], 3, v[3:4]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s0, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo
	global_store_b64 v[3:4], v[1:2], off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9matrixMulPdS_S_i
		.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 12
		.amdhsa_next_free_sgpr 16
		.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	_Z9matrixMulPdS_S_i, .Lfunc_end0-_Z9matrixMulPdS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 336
; NumSgprs: 18
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 12
; 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:         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
    .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:           _Z9matrixMulPdS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9matrixMulPdS_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     12
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
