// system libraries
// use nvcc -o (output name) -Wno-deprecated-gpu-targets -std=c++11 -Xcompiler -fopenmp  file_name.cu
#include <cuda_runtime.h>
#include <cstdio>
#include <cstdlib>
#include <math.h>
#include <chrono>

// size definition. modify as needed
#define N 2000
#define T_SIZE 32

using namespace std;

// safe call definition
static inline void _safe_cuda_call(cudaError err, const char* msg, const char* file_name, const int line_number){
	if(err!=cudaSuccess){
		fprintf(stderr,"%s\n\nFile: %s\n\nLine Number: %d\n\nReason: %s\n",msg,file_name,line_number,cudaGetErrorString(err));
		exit(EXIT_FAILURE);
	}
}

// safe call definition
#define SAFE_CALL(call,msg) _safe_cuda_call(call,msg,__FILE__,__LINE__)

// initialize major row matrix
void initializeMatrix(float *ip, const int nxy){
  srand (static_cast <unsigned> (time(0)));
  float random;
  for(int i = 0; i < nxy; i++){
    random = 1.0 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(10.0-1.0)));
    ip[i] = random;
  }
    return;
}


// utility function to check result
void checkResult(float *hostRef, float *gpuRef, const int nxy){
    double epsilon = 1.0E-8;
    bool match = 1;

    for (int i = 0; i < nxy; i++){
        if (abs(hostRef[i] - gpuRef[i]) > epsilon){
            match = 0;
            printf("host %f gpu %f\n", hostRef[i], gpuRef[i]);
            break;
        }
    }

    if (match)
        printf("Arrays match.\n\n");
    else
        printf("Arrays do not match.\n\n");
}

// multiply matrix on host
void multiplyMatrixOnHost(float *A, float *B, float *C, const int nx){

		for(int i = 0; i < nx; i++) {
			 for(int j = 0; j < nx; j++) {
					 for(int k = 0; k < nx; k++) {
							 C[i * nx + j] += A[i * nx + k] * B[j + k * nx];
					 }
			 }
	 }

    return;
}

// function to multiply matrix on host with threads
void multiplyMatrixOnHostThreads(float *A, float *B, float *C, const int nx){

    int i = 0;
    // use the pragma directive to automatically paralelize
    #pragma omp parallel for private(i) shared(A, B, C)
		for(i = 0; i < nx; i++) {
			 for(int j = 0; j < nx; j++) {
					 for(int k = 0; k < nx; k++) {
							 C[i * nx + j] += A[i * nx + k] * B[j + k * nx];
					 }
			 }
	 }

    return;
}

// kernel to multiply matrix on gpu
__global__ void multiplyMatrixOnGPU(float *A, float *B, float *C, const int nx){

		// get ix and iy from cuda defined variables
		unsigned int ix = blockIdx.x * blockDim.x + threadIdx.x;
		unsigned int iy = blockIdx.y * blockDim.y + threadIdx.y;

    float sum = 0.0;
    if (ix < nx && iy < nx){
        for(int i = 0; i < nx ; i++)
            sum += A[iy * nx + i] * B[i * nx + ix];
        C[iy * nx + ix] = sum;
    }

}

// Kernel GPU Tiles
__global__ void multiplyMatrixOnGPUTiles(float *A, float *B, float *C, const int nx){
	// Create the shared memory space as tiles
	__shared__ float tileOne[T_SIZE][T_SIZE], tileTwo[T_SIZE][T_SIZE];

	// Get the ix and iy indexes
	unsigned int ix = T_SIZE * blockIdx.x + threadIdx.x;
	unsigned int iy = T_SIZE * blockIdx.y + threadIdx.y;

  // int limit = (T_SIZE + nx - 1)/T_SIZE;
	// Get other limit to experiment
	int limit = ceilf(((float)T_SIZE + (float)nx)/(float)T_SIZE);
	// Partial Sum acumulator
	float partialSum = 0.0;

  int i = 0;
  while(i < limit){
			// Fetch values for each value of the tiles with restriction
			if ((iy < nx) && ((i * T_SIZE + threadIdx.x) < nx)){
				int id = (iy * nx) + (i * T_SIZE) + threadIdx.x;
				tileOne[threadIdx.y][threadIdx.x] = A[id];
			}else{
        tileOne[threadIdx.y][threadIdx.x] = 0.0;
				// DO NOT PRINT RACE CONDITION GIVES WRONG OUTPUT
				// cuPrintf(""); <--- deprecated
				// printf("Improper Tile Size in X domain, zeroing\n");
			}

      // Wait for threads to finish
			__syncthreads();

			// Fetch values for each value of the tiles with restriction
			if ((ix < nx) && ((i * T_SIZE + threadIdx.y) < nx)){
				int id = (i * T_SIZE + threadIdx.y) * nx + ix;
				tileTwo[threadIdx.y][threadIdx.x] = B[id];
			}else{
        tileTwo[threadIdx.y][threadIdx.x] = 0.0;
				// DO NOT PRINT RACE CONDITION GIVES WRONG OUTPUT
				// printf("Improper Tile Size in Y domain, zeroing\n");
			}

			// Wait for threads to finish
			__syncthreads();

			//Perform partial sum on tile
      #pragma unroll // T_SIZE is constant
			for (int j = 0; j < T_SIZE; j++){
					partialSum += tileOne[threadIdx.y][j] * tileTwo[j][threadIdx.x];
			}

			// DO NOT PRINT RACE CONDITION GIVES WRONG OUTPUT
			//printf("Partial Sum fetched with value %f\n", partialSum);
			// Wait for threads to finish
			__syncthreads();
      i++;
		}
    if (ix < nx && iy < nx)
        C[((blockIdx.y * blockDim.y + threadIdx.y) * nx) + (blockIdx.x * blockDim.x) + threadIdx.x] = partialSum;
}

int main(int argc, char* argv[]) {
  printf("%s Starting...\n", argv[0]);

  // set up device
  int dev = 0;
  cudaDeviceProp deviceProp;
  SAFE_CALL(cudaGetDeviceProperties(&deviceProp, dev), "Error device prop");
  printf("Using Device %d: %s\n", dev, deviceProp.name);
  SAFE_CALL(cudaSetDevice(dev), "Error setting device");

  int nx = N;
  int ny = N;
  int nxy = nx * ny;
  int nBytes = nxy * sizeof(float*);
  printf("Matrix size: nx %d ny %d\n", nx, ny);

  // malloc host memory
  float *h_A = (float *)malloc(nBytes);
  float *h_B = (float *)malloc(nBytes);
  float *hostRef = (float *)malloc(nBytes);
  float *hostRefThreads = (float *)malloc(nBytes);
  float *gpuRef = (float *)malloc(nBytes);
	float *gpuRefTiles = (float *)malloc(nBytes);

  // initialize matrix
  initializeMatrix(h_A, nxy);
  initializeMatrix(h_B, nxy);

  // initialize to 0
  memset(hostRef, 0, nBytes);
  memset(hostRefThreads, 0, nBytes);
  memset(gpuRef, 0, nBytes);
	memset(gpuRefTiles, 0, nBytes);

  // // multiply matrix on host
  // auto start_cpu = std::chrono::high_resolution_clock::now();
  // multiplyMatrixOnHost(h_A, h_B, hostRef, nx);
  // auto end_cpu =  std::chrono::high_resolution_clock::now();
  // std::chrono::duration<float, std::milli> duration_ms = end_cpu - start_cpu;
  // printf("multiplyMatrixOnHost elapsed %f ms\n", duration_ms.count());

  // // multiply matrix on host with threads
  // start_cpu =  std::chrono::high_resolution_clock::now();
  // multiplyMatrixOnHostThreads(h_A, h_B, hostRefThreads, nx);
  // end_cpu =  std::chrono::high_resolution_clock::now();
  // duration_ms = end_cpu - start_cpu;
  // printf("multiplyMatrixOnHostThreads elapsed %f ms\n", duration_ms.count());

  // // check results
  // checkResult(hostRef, hostRefThreads, nx);

  // malloc device global memory
  float *d_MatA, *d_MatB, *d_MatC, *d_MatD;
  SAFE_CALL(cudaMalloc((void **)&d_MatA, nBytes), "Error allocating d_MatA");
  SAFE_CALL(cudaMalloc((void **)&d_MatB, nBytes), "Error allocating d_MatB");
  SAFE_CALL(cudaMalloc((void **)&d_MatC, nBytes), "Error allocating d_MatC");
	SAFE_CALL(cudaMalloc((void **)&d_MatD, nBytes), "Error allocating d_MatC");

  // transfer data from host to device
  SAFE_CALL(cudaMemcpy(d_MatA, h_A, nBytes, cudaMemcpyHostToDevice), "Error copying d_MatA");
  SAFE_CALL(cudaMemcpy(d_MatB, h_B, nBytes, cudaMemcpyHostToDevice), "Error copying d_MatB");
  SAFE_CALL(cudaMemset(d_MatC, 0, nBytes), "Error copying d_MatB");
	SAFE_CALL(cudaMemset(d_MatD, 0, nBytes), "Error copying d_MatB");

  // kernel definition and launch
  dim3 block(T_SIZE, T_SIZE);
  // use other grid to experiment
  // dim3 grid((nx + block.x - 1) / block.x, (ny + block.y - 1) / block.y);
  dim3 grid((int)ceil((float)nx / T_SIZE), (int)ceil((float)nx / T_SIZE));

  // launch
  auto start_cpu = std::chrono::high_resolution_clock::now();
  multiplyMatrixOnGPU<<<grid, block>>>(d_MatA, d_MatB, d_MatC, nx);
  SAFE_CALL(cudaDeviceSynchronize(), "Error executing kernel");
  auto end_cpu =  std::chrono::high_resolution_clock::now();

  // measure total time
  std::chrono::duration<float, std::milli> duration_ms = end_cpu - start_cpu;
  printf("multiplyMatrixOnGPU elapsed %f ms\n", duration_ms.count());

  // SAFE_CALL kernel error
  SAFE_CALL(cudaGetLastError(), "Error with last error");

  // copy kernel result back to host side
  SAFE_CALL(cudaMemcpy(gpuRef, d_MatC, nBytes, cudaMemcpyDeviceToHost), "Error copying d_MatC");

  // check device results
  //checkResult(hostRef, gpuRef, nx);

	// GPU TILE VERSION AND COMPARISSON
	// launch
	start_cpu = std::chrono::high_resolution_clock::now();
	multiplyMatrixOnGPUTiles<<<grid, block>>>(d_MatA, d_MatB, d_MatD, nx);
	SAFE_CALL(cudaDeviceSynchronize(), "Error executing kernel");
	end_cpu =  std::chrono::high_resolution_clock::now();

	// measure total time
	duration_ms = end_cpu - start_cpu;
	printf("multiplyMatrixOnGPUTiles elapsed %f ms\n", duration_ms.count());

	// SAFE_CALL kernel error
	SAFE_CALL(cudaGetLastError(), "Error with last error");

 	// copy kernel result back to host side
	SAFE_CALL(cudaMemcpy(gpuRefTiles, d_MatD, nBytes, cudaMemcpyDeviceToHost), "Error copying d_MatC");

	// check device results
	checkResult(gpuRef, gpuRefTiles, nx);
	// END GPU TILE VERSION AND COMPARISSON

  // free device global memory
  SAFE_CALL(cudaFree(d_MatA), "Error freeing memory");
  SAFE_CALL(cudaFree(d_MatB), "Error freeing memory");
  SAFE_CALL(cudaFree(d_MatC), "Error freeing memory");
	SAFE_CALL(cudaFree(d_MatD), "Error freeing memory");

  // free host memory
  free(h_A);
  free(h_B);
  free(hostRef);
  free(hostRefThreads);
  free(gpuRef);
	free(gpuRefTiles);

  // reset device
  SAFE_CALL(cudaDeviceReset(), "Error reseting");

  return (0);

}

	.file	"tmpxft_0025c318_00000000-6_matrixMultiplicationTilesCompareGPU.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2138:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2138:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/Programacion-multinucleo-2018/a-3-tilled-matrix-multiplication-legalgui/master/matrixMultiplicationTilesCompareGPU.cu"
.LC1:
	.string	"%s\n\nFile: %s\n\nLine Number: %d\n\nReason: %s\n"
	.text
	.type	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0, @function
_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0:
.LFB2339:
	.cfi_startproc
	testl	%edi, %edi
	je	.L2
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rsi, %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movl	%edx, 12(%rsp)
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movq	%rbx, %rcx
	leaq	.LC0(%rip), %r8
	pushq	%rdx
	.cfi_def_cfa_offset 40
	movl	$2, %esi
	leaq	.LC1(%rip), %rdx
	pushq	%rax
	.cfi_def_cfa_offset 48
	movl	28(%rsp), %r9d
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	ret
	.cfi_endproc
.LFE2339:
	.size	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0, .-_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	.globl	_Z16initializeMatrixPfi
	.type	_Z16initializeMatrixPfi, @function
_Z16initializeMatrixPfi:
.LFB2127:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rdi, %r12
	xorl	%edi, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
.L9:
	cmpl	%ebx, %ebp
	jle	.L12
	call	rand@PLT
	cvtsi2ssl	%eax, %xmm0
	divss	.LC2(%rip), %xmm0
	addss	.LC3(%rip), %xmm0
	movss	%xmm0, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L9
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2127:
	.size	_Z16initializeMatrixPfi, .-_Z16initializeMatrixPfi
	.section	.rodata.str1.1
.LC6:
	.string	"host %f gpu %f\n"
.LC7:
	.string	"Arrays do not match.\n\n"
.LC8:
	.string	"Arrays match.\n\n"
	.text
	.globl	_Z11checkResultPfS_i
	.type	_Z11checkResultPfS_i, @function
_Z11checkResultPfS_i:
.LFB2128:
	.cfi_startproc
	endbr64
	movsd	.LC5(%rip), %xmm4
	xorl	%eax, %eax
	movss	.LC4(%rip), %xmm3
.L14:
	cmpl	%eax, %edx
	jle	.L22
	movss	(%rdi,%rax,4), %xmm0
	movss	(%rsi,%rax,4), %xmm1
	incq	%rax
	movaps	%xmm0, %xmm2
	subss	%xmm1, %xmm2
	andps	%xmm3, %xmm2
	cvtss2sd	%xmm2, %xmm2
	comisd	%xmm4, %xmm2
	jbe	.L14
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$2, %edi
	movb	$2, %al
	cvtss2sd	%xmm0, %xmm0
	leaq	.LC6(%rip), %rsi
	cvtss2sd	%xmm1, %xmm1
	call	__printf_chk@PLT
	leaq	.LC7(%rip), %rsi
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	movl	$2, %edi
	jmp	.L21
.L22:
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
.L21:
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2128:
	.size	_Z11checkResultPfS_i, .-_Z11checkResultPfS_i
	.globl	_Z20multiplyMatrixOnHostPfS_S_i
	.type	_Z20multiplyMatrixOnHostPfS_S_i, @function
_Z20multiplyMatrixOnHostPfS_S_i:
.LFB2129:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdx, %r10
	movq	%rdi, %r8
	xorl	%edx, %edx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rsi, %rbx
	movslq	%ecx, %rsi
	movq	%rsi, %rax
	salq	$2, %rsi
.L24:
	cmpl	%eax, %ebp
	jge	.L23
	movq	%rbx, %r11
	leaq	(%r10,%rdx), %rcx
	leaq	(%r8,%rdx), %r13
	xorl	%r9d, %r9d
.L28:
	movq	%r11, %r12
	xorl	%edi, %edi
.L25:
	movss	0(%r13,%rdi,4), %xmm0
	mulss	(%r12), %xmm0
	incq	%rdi
	addq	%rsi, %r12
	addss	(%rcx), %xmm0
	movss	%xmm0, (%rcx)
	cmpl	%edi, %eax
	jg	.L25
	incl	%r9d
	addq	$4, %r11
	addq	$4, %rcx
	cmpl	%r9d, %eax
	jne	.L28
	incl	%ebp
	addq	%rsi, %rdx
	jmp	.L24
.L23:
	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
.LFE2129:
	.size	_Z20multiplyMatrixOnHostPfS_S_i, .-_Z20multiplyMatrixOnHostPfS_S_i
	.globl	_Z27multiplyMatrixOnHostThreadsPfS_S_i
	.type	_Z27multiplyMatrixOnHostThreadsPfS_S_i, @function
_Z27multiplyMatrixOnHostThreadsPfS_S_i:
.LFB2338:
	.cfi_startproc
	endbr64
	jmp	_Z20multiplyMatrixOnHostPfS_S_i
	.cfi_endproc
.LFE2338:
	.size	_Z27multiplyMatrixOnHostThreadsPfS_S_i, .-_Z27multiplyMatrixOnHostThreadsPfS_S_i
	.globl	_Z44__device_stub__Z19multiplyMatrixOnGPUPfS_S_iPfS_S_i
	.type	_Z44__device_stub__Z19multiplyMatrixOnGPUPfS_S_iPfS_S_i, @function
_Z44__device_stub__Z19multiplyMatrixOnGPUPfS_S_iPfS_S_i:
.LFB2160:
	.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	.L32
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z19multiplyMatrixOnGPUPfS_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
.L32:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2160:
	.size	_Z44__device_stub__Z19multiplyMatrixOnGPUPfS_S_iPfS_S_i, .-_Z44__device_stub__Z19multiplyMatrixOnGPUPfS_S_iPfS_S_i
	.globl	_Z19multiplyMatrixOnGPUPfS_S_i
	.type	_Z19multiplyMatrixOnGPUPfS_S_i, @function
_Z19multiplyMatrixOnGPUPfS_S_i:
.LFB2161:
	.cfi_startproc
	endbr64
	jmp	_Z44__device_stub__Z19multiplyMatrixOnGPUPfS_S_iPfS_S_i
	.cfi_endproc
.LFE2161:
	.size	_Z19multiplyMatrixOnGPUPfS_S_i, .-_Z19multiplyMatrixOnGPUPfS_S_i
	.globl	_Z49__device_stub__Z24multiplyMatrixOnGPUTilesPfS_S_iPfS_S_i
	.type	_Z49__device_stub__Z24multiplyMatrixOnGPUTilesPfS_S_iPfS_S_i, @function
_Z49__device_stub__Z24multiplyMatrixOnGPUTilesPfS_S_iPfS_S_i:
.LFB2162:
	.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	.L37
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z24multiplyMatrixOnGPUTilesPfS_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
.L37:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L39
	call	__stack_chk_fail@PLT
.L39:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2162:
	.size	_Z49__device_stub__Z24multiplyMatrixOnGPUTilesPfS_S_iPfS_S_i, .-_Z49__device_stub__Z24multiplyMatrixOnGPUTilesPfS_S_iPfS_S_i
	.globl	_Z24multiplyMatrixOnGPUTilesPfS_S_i
	.type	_Z24multiplyMatrixOnGPUTilesPfS_S_i, @function
_Z24multiplyMatrixOnGPUTilesPfS_S_i:
.LFB2163:
	.cfi_startproc
	endbr64
	jmp	_Z49__device_stub__Z24multiplyMatrixOnGPUTilesPfS_S_iPfS_S_i
	.cfi_endproc
.LFE2163:
	.size	_Z24multiplyMatrixOnGPUTilesPfS_S_i, .-_Z24multiplyMatrixOnGPUTilesPfS_S_i
	.section	.rodata.str1.1
.LC9:
	.string	"%s Starting...\n"
.LC10:
	.string	"Error device prop"
.LC11:
	.string	"Using Device %d: %s\n"
.LC12:
	.string	"Error setting device"
.LC13:
	.string	"Matrix size: nx %d ny %d\n"
.LC14:
	.string	"Error allocating d_MatA"
.LC15:
	.string	"Error allocating d_MatB"
.LC16:
	.string	"Error allocating d_MatC"
.LC17:
	.string	"Error copying d_MatA"
.LC18:
	.string	"Error copying d_MatB"
.LC19:
	.string	"Error executing kernel"
.LC21:
	.string	"multiplyMatrixOnGPU elapsed %f ms\n"
.LC22:
	.string	"Error with last error"
.LC23:
	.string	"Error copying d_MatC"
.LC24:
	.string	"multiplyMatrixOnGPUTiles elapsed %f ms\n"
.LC25:
	.string	"Error freeing memory"
.LC26:
	.string	"Error reseting"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2131:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$2, %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
	leaq	.LC16(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$1128, %rsp
	.cfi_def_cfa_offset 1184
	movq	(%rsi), %rdx
	leaq	.LC9(%rip), %rsi
	movq	%fs:40, %rax
	movq	%rax, 1112(%rsp)
	xorl	%eax, %eax
	leaq	80(%rsp), %rbx
	call	__printf_chk@PLT
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movl	$170, %edx
	leaq	.LC10(%rip), %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	%rbx, %rcx
	xorl	%edx, %edx
	movl	$2, %edi
	leaq	.LC11(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%edi, %edi
	call	cudaSetDevice@PLT
	movl	$172, %edx
	leaq	.LC12(%rip), %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movl	$2000, %edx
	movl	$2000, %ecx
	xorl	%eax, %eax
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$32000000, %edi
	call	malloc@PLT
	movl	$32000000, %edi
	movq	%rax, %rbp
	call	malloc@PLT
	movl	$32000000, %edi
	movq	%rax, %rbx
	call	malloc@PLT
	movl	$32000000, %edi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movl	$4000000, %esi
	movq	%rbp, %rdi
	movq	%rax, 8(%rsp)
	call	_Z16initializeMatrixPfi
	movl	$4000000, %esi
	movq	%rbx, %rdi
	call	_Z16initializeMatrixPfi
	movq	(%rsp), %rdi
	xorl	%eax, %eax
	movl	$8000000, %ecx
	movl	$32000000, %esi
	rep stosl
	movq	8(%rsp), %rdi
	movl	$8000000, %ecx
	rep stosl
	leaq	24(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$217, %edx
	leaq	.LC14(%rip), %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	leaq	32(%rsp), %rdi
	movl	$32000000, %esi
	call	cudaMalloc@PLT
	movl	$218, %edx
	leaq	.LC15(%rip), %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	leaq	40(%rsp), %rdi
	movl	$32000000, %esi
	call	cudaMalloc@PLT
	movl	$219, %edx
	movq	%r12, %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	leaq	48(%rsp), %rdi
	movl	$32000000, %esi
	call	cudaMalloc@PLT
	movq	%r12, %rsi
	movl	$220, %edx
	leaq	.LC18(%rip), %r12
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$32000000, %edx
	call	cudaMemcpy@PLT
	movl	$223, %edx
	leaq	.LC17(%rip), %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$32000000, %edx
	call	cudaMemcpy@PLT
	movq	%r12, %rsi
	movl	$224, %edx
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	movl	$32000000, %edx
	call	cudaMemset@PLT
	movq	%r12, %rsi
	movl	$225, %edx
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	movl	$32000000, %edx
	call	cudaMemset@PLT
	movq	%r12, %rsi
	movl	$226, %edx
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movl	$1, 64(%rsp)
	movabsq	$137438953504, %rax
	movq	%rax, 56(%rsp)
	movabsq	$270582939711, %rax
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movl	64(%rsp), %ecx
	movl	76(%rsp), %esi
	xorl	%r9d, %r9d
	movq	56(%rsp), %rdx
	movq	68(%rsp), %rdi
	xorl	%r8d, %r8d
	movq	%rax, %r12
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L43
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$2000, %ecx
	movq	24(%rsp), %rdi
	call	_Z44__device_stub__Z19multiplyMatrixOnGPUPfS_S_iPfS_S_i
.L43:
	call	cudaDeviceSynchronize@PLT
	leaq	.LC19(%rip), %r15
	movl	$237, %edx
	leaq	.LC22(%rip), %r14
	movl	%eax, %edi
	movq	%r15, %rsi
	leaq	.LC23(%rip), %r13
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	leaq	.LC21(%rip), %rsi
	movl	$2, %edi
	subq	%r12, %rax
	cvtsi2ssq	%rax, %xmm0
	movb	$1, %al
	divss	.LC20(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	call	cudaGetLastError@PLT
	movl	$245, %edx
	movq	%r14, %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	40(%rsp), %rsi
	movq	(%rsp), %rdi
	movl	$2, %ecx
	movl	$32000000, %edx
	call	cudaMemcpy@PLT
	movl	$248, %edx
	movq	%r13, %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movl	64(%rsp), %ecx
	movl	76(%rsp), %esi
	xorl	%r9d, %r9d
	movq	56(%rsp), %rdx
	movq	68(%rsp), %rdi
	xorl	%r8d, %r8d
	movq	%rax, %r12
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L44
	movq	48(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$2000, %ecx
	movq	24(%rsp), %rdi
	call	_Z49__device_stub__Z24multiplyMatrixOnGPUTilesPfS_S_iPfS_S_i
.L44:
	call	cudaDeviceSynchronize@PLT
	movl	$257, %edx
	movq	%r15, %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	leaq	.LC24(%rip), %rsi
	movl	$2, %edi
	subq	%r12, %rax
	leaq	.LC25(%rip), %r12
	cvtsi2ssq	%rax, %xmm0
	movb	$1, %al
	divss	.LC20(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	call	cudaGetLastError@PLT
	movl	$265, %edx
	movq	%r14, %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	48(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$2, %ecx
	movl	$32000000, %edx
	call	cudaMemcpy@PLT
	movl	$268, %edx
	movq	%r13, %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movl	$2000, %edx
	call	_Z11checkResultPfS_i
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movl	$275, %edx
	movq	%r12, %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movl	$276, %edx
	movq	%r12, %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movl	$277, %edx
	movq	%r12, %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movl	$278, %edx
	movq	%r12, %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	%rbp, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	(%rsp), %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	call	cudaDeviceReset@PLT
	movl	$289, %edx
	leaq	.LC26(%rip), %rsi
	movl	%eax, %edi
	call	_ZL15_safe_cuda_call9cudaErrorPKcS1_i.constprop.0
	movq	1112(%rsp), %rax
	subq	%fs:40, %rax
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	addq	$1128, %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
.LFE2131:
	.size	main, .-main
	.section	.rodata.str1.1
.LC27:
	.string	"_Z24multiplyMatrixOnGPUTilesPfS_S_i"
.LC28:
	.string	"_Z19multiplyMatrixOnGPUPfS_S_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2165:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -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	.LC27(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z24multiplyMatrixOnGPUTilesPfS_S_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC28(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z19multiplyMatrixOnGPUPfS_S_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	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	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2165:
	.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	1298370105
	.align 4
.LC3:
	.long	1065353216
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC4:
	.long	2147483647
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC5:
	.long	-500134854
	.long	1044740494
	.section	.rodata.cst4
	.align 4
.LC20:
	.long	1232348160
	.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:

// system libraries
// use nvcc -o (output name) -Wno-deprecated-gpu-targets -std=c++11 -Xcompiler -fopenmp  file_name.cu
#include <hip/hip_runtime.h>
#include <cstdio>
#include <cstdlib>
#include <math.h>
#include <chrono>

// size definition. modify as needed
#define N 2000
#define T_SIZE 32

using namespace std;

// safe call definition
static inline void _safe_cuda_call(hipError_t err, const char* msg, const char* file_name, const int line_number){
	if(err!=hipSuccess){
		fprintf(stderr,"%s\n\nFile: %s\n\nLine Number: %d\n\nReason: %s\n",msg,file_name,line_number,hipGetErrorString(err));
		exit(EXIT_FAILURE);
	}
}

// safe call definition
#define SAFE_CALL(call,msg) _safe_cuda_call(call,msg,__FILE__,__LINE__)

// initialize major row matrix
void initializeMatrix(float *ip, const int nxy){
  srand (static_cast <unsigned> (time(0)));
  float random;
  for(int i = 0; i < nxy; i++){
    random = 1.0 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(10.0-1.0)));
    ip[i] = random;
  }
    return;
}


// utility function to check result
void checkResult(float *hostRef, float *gpuRef, const int nxy){
    double epsilon = 1.0E-8;
    bool match = 1;

    for (int i = 0; i < nxy; i++){
        if (abs(hostRef[i] - gpuRef[i]) > epsilon){
            match = 0;
            printf("host %f gpu %f\n", hostRef[i], gpuRef[i]);
            break;
        }
    }

    if (match)
        printf("Arrays match.\n\n");
    else
        printf("Arrays do not match.\n\n");
}

// multiply matrix on host
void multiplyMatrixOnHost(float *A, float *B, float *C, const int nx){

		for(int i = 0; i < nx; i++) {
			 for(int j = 0; j < nx; j++) {
					 for(int k = 0; k < nx; k++) {
							 C[i * nx + j] += A[i * nx + k] * B[j + k * nx];
					 }
			 }
	 }

    return;
}

// function to multiply matrix on host with threads
void multiplyMatrixOnHostThreads(float *A, float *B, float *C, const int nx){

    int i = 0;
    // use the pragma directive to automatically paralelize
    #pragma omp parallel for private(i) shared(A, B, C)
		for(i = 0; i < nx; i++) {
			 for(int j = 0; j < nx; j++) {
					 for(int k = 0; k < nx; k++) {
							 C[i * nx + j] += A[i * nx + k] * B[j + k * nx];
					 }
			 }
	 }

    return;
}

// kernel to multiply matrix on gpu
__global__ void multiplyMatrixOnGPU(float *A, float *B, float *C, const int nx){

		// get ix and iy from cuda defined variables
		unsigned int ix = blockIdx.x * blockDim.x + threadIdx.x;
		unsigned int iy = blockIdx.y * blockDim.y + threadIdx.y;

    float sum = 0.0;
    if (ix < nx && iy < nx){
        for(int i = 0; i < nx ; i++)
            sum += A[iy * nx + i] * B[i * nx + ix];
        C[iy * nx + ix] = sum;
    }

}

// Kernel GPU Tiles
__global__ void multiplyMatrixOnGPUTiles(float *A, float *B, float *C, const int nx){
	// Create the shared memory space as tiles
	__shared__ float tileOne[T_SIZE][T_SIZE], tileTwo[T_SIZE][T_SIZE];

	// Get the ix and iy indexes
	unsigned int ix = T_SIZE * blockIdx.x + threadIdx.x;
	unsigned int iy = T_SIZE * blockIdx.y + threadIdx.y;

  // int limit = (T_SIZE + nx - 1)/T_SIZE;
	// Get other limit to experiment
	int limit = ceilf(((float)T_SIZE + (float)nx)/(float)T_SIZE);
	// Partial Sum acumulator
	float partialSum = 0.0;

  int i = 0;
  while(i < limit){
			// Fetch values for each value of the tiles with restriction
			if ((iy < nx) && ((i * T_SIZE + threadIdx.x) < nx)){
				int id = (iy * nx) + (i * T_SIZE) + threadIdx.x;
				tileOne[threadIdx.y][threadIdx.x] = A[id];
			}else{
        tileOne[threadIdx.y][threadIdx.x] = 0.0;
				// DO NOT PRINT RACE CONDITION GIVES WRONG OUTPUT
				// cuPrintf(""); <--- deprecated
				// printf("Improper Tile Size in X domain, zeroing\n");
			}

      // Wait for threads to finish
			__syncthreads();

			// Fetch values for each value of the tiles with restriction
			if ((ix < nx) && ((i * T_SIZE + threadIdx.y) < nx)){
				int id = (i * T_SIZE + threadIdx.y) * nx + ix;
				tileTwo[threadIdx.y][threadIdx.x] = B[id];
			}else{
        tileTwo[threadIdx.y][threadIdx.x] = 0.0;
				// DO NOT PRINT RACE CONDITION GIVES WRONG OUTPUT
				// printf("Improper Tile Size in Y domain, zeroing\n");
			}

			// Wait for threads to finish
			__syncthreads();

			//Perform partial sum on tile
      #pragma unroll // T_SIZE is constant
			for (int j = 0; j < T_SIZE; j++){
					partialSum += tileOne[threadIdx.y][j] * tileTwo[j][threadIdx.x];
			}

			// DO NOT PRINT RACE CONDITION GIVES WRONG OUTPUT
			//printf("Partial Sum fetched with value %f\n", partialSum);
			// Wait for threads to finish
			__syncthreads();
      i++;
		}
    if (ix < nx && iy < nx)
        C[((blockIdx.y * blockDim.y + threadIdx.y) * nx) + (blockIdx.x * blockDim.x) + threadIdx.x] = partialSum;
}

int main(int argc, char* argv[]) {
  printf("%s Starting...\n", argv[0]);

  // set up device
  int dev = 0;
  hipDeviceProp_t deviceProp;
  SAFE_CALL(hipGetDeviceProperties(&deviceProp, dev), "Error device prop");
  printf("Using Device %d: %s\n", dev, deviceProp.name);
  SAFE_CALL(hipSetDevice(dev), "Error setting device");

  int nx = N;
  int ny = N;
  int nxy = nx * ny;
  int nBytes = nxy * sizeof(float*);
  printf("Matrix size: nx %d ny %d\n", nx, ny);

  // malloc host memory
  float *h_A = (float *)malloc(nBytes);
  float *h_B = (float *)malloc(nBytes);
  float *hostRef = (float *)malloc(nBytes);
  float *hostRefThreads = (float *)malloc(nBytes);
  float *gpuRef = (float *)malloc(nBytes);
	float *gpuRefTiles = (float *)malloc(nBytes);

  // initialize matrix
  initializeMatrix(h_A, nxy);
  initializeMatrix(h_B, nxy);

  // initialize to 0
  memset(hostRef, 0, nBytes);
  memset(hostRefThreads, 0, nBytes);
  memset(gpuRef, 0, nBytes);
	memset(gpuRefTiles, 0, nBytes);

  // // multiply matrix on host
  // auto start_cpu = std::chrono::high_resolution_clock::now();
  // multiplyMatrixOnHost(h_A, h_B, hostRef, nx);
  // auto end_cpu =  std::chrono::high_resolution_clock::now();
  // std::chrono::duration<float, std::milli> duration_ms = end_cpu - start_cpu;
  // printf("multiplyMatrixOnHost elapsed %f ms\n", duration_ms.count());

  // // multiply matrix on host with threads
  // start_cpu =  std::chrono::high_resolution_clock::now();
  // multiplyMatrixOnHostThreads(h_A, h_B, hostRefThreads, nx);
  // end_cpu =  std::chrono::high_resolution_clock::now();
  // duration_ms = end_cpu - start_cpu;
  // printf("multiplyMatrixOnHostThreads elapsed %f ms\n", duration_ms.count());

  // // check results
  // checkResult(hostRef, hostRefThreads, nx);

  // malloc device global memory
  float *d_MatA, *d_MatB, *d_MatC, *d_MatD;
  SAFE_CALL(hipMalloc((void **)&d_MatA, nBytes), "Error allocating d_MatA");
  SAFE_CALL(hipMalloc((void **)&d_MatB, nBytes), "Error allocating d_MatB");
  SAFE_CALL(hipMalloc((void **)&d_MatC, nBytes), "Error allocating d_MatC");
	SAFE_CALL(hipMalloc((void **)&d_MatD, nBytes), "Error allocating d_MatC");

  // transfer data from host to device
  SAFE_CALL(hipMemcpy(d_MatA, h_A, nBytes, hipMemcpyHostToDevice), "Error copying d_MatA");
  SAFE_CALL(hipMemcpy(d_MatB, h_B, nBytes, hipMemcpyHostToDevice), "Error copying d_MatB");
  SAFE_CALL(hipMemset(d_MatC, 0, nBytes), "Error copying d_MatB");
	SAFE_CALL(hipMemset(d_MatD, 0, nBytes), "Error copying d_MatB");

  // kernel definition and launch
  dim3 block(T_SIZE, T_SIZE);
  // use other grid to experiment
  // dim3 grid((nx + block.x - 1) / block.x, (ny + block.y - 1) / block.y);
  dim3 grid((int)ceil((float)nx / T_SIZE), (int)ceil((float)nx / T_SIZE));

  // launch
  auto start_cpu = std::chrono::high_resolution_clock::now();
  multiplyMatrixOnGPU<<<grid, block>>>(d_MatA, d_MatB, d_MatC, nx);
  SAFE_CALL(hipDeviceSynchronize(), "Error executing kernel");
  auto end_cpu =  std::chrono::high_resolution_clock::now();

  // measure total time
  std::chrono::duration<float, std::milli> duration_ms = end_cpu - start_cpu;
  printf("multiplyMatrixOnGPU elapsed %f ms\n", duration_ms.count());

  // SAFE_CALL kernel error
  SAFE_CALL(hipGetLastError(), "Error with last error");

  // copy kernel result back to host side
  SAFE_CALL(hipMemcpy(gpuRef, d_MatC, nBytes, hipMemcpyDeviceToHost), "Error copying d_MatC");

  // check device results
  //checkResult(hostRef, gpuRef, nx);

	// GPU TILE VERSION AND COMPARISSON
	// launch
	start_cpu = std::chrono::high_resolution_clock::now();
	multiplyMatrixOnGPUTiles<<<grid, block>>>(d_MatA, d_MatB, d_MatD, nx);
	SAFE_CALL(hipDeviceSynchronize(), "Error executing kernel");
	end_cpu =  std::chrono::high_resolution_clock::now();

	// measure total time
	duration_ms = end_cpu - start_cpu;
	printf("multiplyMatrixOnGPUTiles elapsed %f ms\n", duration_ms.count());

	// SAFE_CALL kernel error
	SAFE_CALL(hipGetLastError(), "Error with last error");

 	// copy kernel result back to host side
	SAFE_CALL(hipMemcpy(gpuRefTiles, d_MatD, nBytes, hipMemcpyDeviceToHost), "Error copying d_MatC");

	// check device results
	checkResult(gpuRef, gpuRefTiles, nx);
	// END GPU TILE VERSION AND COMPARISSON

  // free device global memory
  SAFE_CALL(hipFree(d_MatA), "Error freeing memory");
  SAFE_CALL(hipFree(d_MatB), "Error freeing memory");
  SAFE_CALL(hipFree(d_MatC), "Error freeing memory");
	SAFE_CALL(hipFree(d_MatD), "Error freeing memory");

  // free host memory
  free(h_A);
  free(h_B);
  free(hostRef);
  free(hostRefThreads);
  free(gpuRef);
	free(gpuRefTiles);

  // reset device
  SAFE_CALL(hipDeviceReset(), "Error reseting");

  return (0);

}

	.text
	.file	"matrixMultiplicationTilesCompareGPU.hip"
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z16initializeMatrixPfi
.LCPI0_0:
	.long	0x4d638e39                      # float 238609296
.LCPI0_1:
	.long	0x3f800000                      # float 1
	.text
	.globl	_Z16initializeMatrixPfi
	.type	_Z16initializeMatrixPfi,@function
_Z16initializeMatrixPfi:                # @_Z16initializeMatrixPfi
	.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	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebp
	movq	%rdi, %rbx
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	testl	%ebp, %ebp
	jle	.LBB0_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %r14d
	xorl	%r15d, %r15d
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	divss	.LCPI0_0(%rip), %xmm0
	addss	.LCPI0_1(%rip), %xmm0
	movss	%xmm0, (%rbx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB0_2
.LBB0_3:                                # %._crit_edge
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.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_end0:
	.size	_Z16initializeMatrixPfi, .Lfunc_end0-_Z16initializeMatrixPfi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z11checkResultPfS_i
.LCPI1_0:
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI1_1:
	.quad	0x3e45798ee2308c3a              # double 1.0E-8
	.text
	.globl	_Z11checkResultPfS_i
	.type	_Z11checkResultPfS_i,@function
_Z11checkResultPfS_i:                   # @_Z11checkResultPfS_i
	.cfi_startproc
# %bb.0:
	movq	%rdi, %rax
	movl	$.Lstr.1, %edi
	testl	%edx, %edx
	jle	puts@PLT                        # TAILCALL
# %bb.1:                                # %.lr.ph.preheader
	movl	%edx, %ecx
	xorl	%edx, %edx
	movaps	.LCPI1_0(%rip), %xmm0           # xmm0 = [NaN,NaN,NaN,NaN]
	movsd	.LCPI1_1(%rip), %xmm1           # xmm1 = mem[0],zero
	jmp	.LBB1_3
.LBB1_2:                                #   in Loop: Header=BB1_3 Depth=1
	incq	%rdx
	cmpq	%rdx, %rcx
	je	puts@PLT                        # TAILCALL
.LBB1_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movss	(%rax,%rdx,4), %xmm2            # xmm2 = mem[0],zero,zero,zero
	movss	(%rsi,%rdx,4), %xmm3            # xmm3 = mem[0],zero,zero,zero
	movaps	%xmm2, %xmm4
	subss	%xmm3, %xmm4
	andps	%xmm0, %xmm4
	cvtss2sd	%xmm4, %xmm4
	ucomisd	%xmm1, %xmm4
	jbe	.LBB1_2
# %bb.4:
	pushq	%rax
	.cfi_def_cfa_offset 16
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm2, %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	%xmm3, %xmm1
	movl	$.L.str, %edi
	movb	$2, %al
	callq	printf
	movl	$.Lstr, %edi
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	jmp	puts@PLT                        # TAILCALL
.Lfunc_end1:
	.size	_Z11checkResultPfS_i, .Lfunc_end1-_Z11checkResultPfS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z20multiplyMatrixOnHostPfS_S_i # -- Begin function _Z20multiplyMatrixOnHostPfS_S_i
	.type	_Z20multiplyMatrixOnHostPfS_S_i,@function
_Z20multiplyMatrixOnHostPfS_S_i:        # @_Z20multiplyMatrixOnHostPfS_S_i
	.cfi_startproc
# %bb.0:
	testl	%ecx, %ecx
	jle	.LBB2_8
# %bb.1:                                # %.preheader23.lr.ph
	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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%ecx, %eax
	leaq	(,%rax,4), %r8
	xorl	%r9d, %r9d
	xorl	%r10d, %r10d
.LBB2_2:                                # %.preheader.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_3 Depth 2
                                        #       Child Loop BB2_4 Depth 3
	movl	%r9d, %r11d
	leaq	(%rdi,%r11,4), %r11
	movq	%r10, %rbx
	imulq	%rax, %rbx
	leaq	(%rdx,%rbx,4), %rbx
	movq	%rsi, %r14
	xorl	%r15d, %r15d
.LBB2_3:                                # %.preheader
                                        #   Parent Loop BB2_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB2_4 Depth 3
	movss	(%rbx,%r15,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movq	%r14, %r12
	xorl	%r13d, %r13d
.LBB2_4:                                #   Parent Loop BB2_2 Depth=1
                                        #     Parent Loop BB2_3 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%r11,%r13,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	(%r12), %xmm1
	addss	%xmm1, %xmm0
	movss	%xmm0, (%rbx,%r15,4)
	incq	%r13
	addq	%r8, %r12
	cmpq	%r13, %rax
	jne	.LBB2_4
# %bb.5:                                # %._crit_edge
                                        #   in Loop: Header=BB2_3 Depth=2
	incq	%r15
	addq	$4, %r14
	cmpq	%rax, %r15
	jne	.LBB2_3
# %bb.6:                                # %._crit_edge26
                                        #   in Loop: Header=BB2_2 Depth=1
	incq	%r10
	addl	%ecx, %r9d
	cmpq	%rax, %r10
	jne	.LBB2_2
# %bb.7:
	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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
.LBB2_8:                                # %._crit_edge28
	retq
.Lfunc_end2:
	.size	_Z20multiplyMatrixOnHostPfS_S_i, .Lfunc_end2-_Z20multiplyMatrixOnHostPfS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z27multiplyMatrixOnHostThreadsPfS_S_i # -- Begin function _Z27multiplyMatrixOnHostThreadsPfS_S_i
	.type	_Z27multiplyMatrixOnHostThreadsPfS_S_i,@function
_Z27multiplyMatrixOnHostThreadsPfS_S_i: # @_Z27multiplyMatrixOnHostThreadsPfS_S_i
	.cfi_startproc
# %bb.0:
	testl	%ecx, %ecx
	jle	.LBB3_8
# %bb.1:                                # %.preheader23.lr.ph
	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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%ecx, %eax
	leaq	(,%rax,4), %r8
	xorl	%r9d, %r9d
	xorl	%r10d, %r10d
.LBB3_2:                                # %.preheader.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_3 Depth 2
                                        #       Child Loop BB3_4 Depth 3
	movl	%r9d, %r11d
	leaq	(%rdi,%r11,4), %r11
	movq	%r10, %rbx
	imulq	%rax, %rbx
	leaq	(%rdx,%rbx,4), %rbx
	movq	%rsi, %r14
	xorl	%r15d, %r15d
.LBB3_3:                                # %.preheader
                                        #   Parent Loop BB3_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB3_4 Depth 3
	movss	(%rbx,%r15,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movq	%r14, %r12
	xorl	%r13d, %r13d
.LBB3_4:                                #   Parent Loop BB3_2 Depth=1
                                        #     Parent Loop BB3_3 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%r11,%r13,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	(%r12), %xmm1
	addss	%xmm1, %xmm0
	movss	%xmm0, (%rbx,%r15,4)
	incq	%r13
	addq	%r8, %r12
	cmpq	%r13, %rax
	jne	.LBB3_4
# %bb.5:                                # %._crit_edge
                                        #   in Loop: Header=BB3_3 Depth=2
	incq	%r15
	addq	$4, %r14
	cmpq	%rax, %r15
	jne	.LBB3_3
# %bb.6:                                # %._crit_edge26
                                        #   in Loop: Header=BB3_2 Depth=1
	incq	%r10
	addl	%ecx, %r9d
	cmpq	%rax, %r10
	jne	.LBB3_2
# %bb.7:
	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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
.LBB3_8:                                # %._crit_edge28
	retq
.Lfunc_end3:
	.size	_Z27multiplyMatrixOnHostThreadsPfS_S_i, .Lfunc_end3-_Z27multiplyMatrixOnHostThreadsPfS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__multiplyMatrixOnGPUPfS_S_i # -- Begin function _Z34__device_stub__multiplyMatrixOnGPUPfS_S_i
	.type	_Z34__device_stub__multiplyMatrixOnGPUPfS_S_i,@function
_Z34__device_stub__multiplyMatrixOnGPUPfS_S_i: # @_Z34__device_stub__multiplyMatrixOnGPUPfS_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	$_Z19multiplyMatrixOnGPUPfS_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_end4:
	.size	_Z34__device_stub__multiplyMatrixOnGPUPfS_S_i, .Lfunc_end4-_Z34__device_stub__multiplyMatrixOnGPUPfS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z39__device_stub__multiplyMatrixOnGPUTilesPfS_S_i # -- Begin function _Z39__device_stub__multiplyMatrixOnGPUTilesPfS_S_i
	.type	_Z39__device_stub__multiplyMatrixOnGPUTilesPfS_S_i,@function
_Z39__device_stub__multiplyMatrixOnGPUTilesPfS_S_i: # @_Z39__device_stub__multiplyMatrixOnGPUTilesPfS_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	$_Z24multiplyMatrixOnGPUTilesPfS_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_end5:
	.size	_Z39__device_stub__multiplyMatrixOnGPUTilesPfS_S_i, .Lfunc_end5-_Z39__device_stub__multiplyMatrixOnGPUTilesPfS_S_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI6_0:
	.long	0x49742400                      # float 1.0E+6
	.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	$1512, %rsp                     # imm = 0x5E8
	.cfi_def_cfa_offset 1568
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	(%rsi), %rsi
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	40(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipGetDevicePropertiesR0600
	testl	%eax, %eax
	jne	.LBB6_1
# %bb.3:                                # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit
	leaq	40(%rsp), %rdx
	movl	$.L.str.6, %edi
	xorl	%esi, %esi
	xorl	%eax, %eax
	callq	printf
	xorl	%edi, %edi
	callq	hipSetDevice
	testl	%eax, %eax
	jne	.LBB6_4
# %bb.5:                                # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit71
	movl	$.L.str.8, %edi
	movl	$2000, %esi                     # imm = 0x7D0
	movl	$2000, %edx                     # imm = 0x7D0
	xorl	%eax, %eax
	callq	printf
	movl	$32000000, %edi                 # imm = 0x1E84800
	callq	malloc
	movq	%rax, %rbx
	movl	$32000000, %edi                 # imm = 0x1E84800
	callq	malloc
	movq	%rax, %r14
	movl	$1, %edi
	movl	$32000000, %esi                 # imm = 0x1E84800
	callq	calloc@PLT
	movq	%rax, %r15
	movl	$1, %edi
	movl	$32000000, %esi                 # imm = 0x1E84800
	callq	calloc@PLT
	movq	%rax, %r12
	movq	%rbx, %rdi
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	_Z16initializeMatrixPfi
	movq	%r14, %rdi
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	_Z16initializeMatrixPfi
	leaq	24(%rsp), %rdi
	movl	$32000000, %esi                 # imm = 0x1E84800
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB6_6
# %bb.7:                                # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit73
	leaq	16(%rsp), %rdi
	movl	$32000000, %esi                 # imm = 0x1E84800
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB6_8
# %bb.9:                                # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit75
	leaq	8(%rsp), %rdi
	movl	$32000000, %esi                 # imm = 0x1E84800
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB6_10
# %bb.11:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit77
	movq	%rsp, %rdi
	movl	$32000000, %esi                 # imm = 0x1E84800
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB6_12
# %bb.13:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit79
	movq	24(%rsp), %rdi
	movl	$32000000, %edx                 # imm = 0x1E84800
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB6_14
# %bb.15:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit81
	movq	16(%rsp), %rdi
	movl	$32000000, %edx                 # imm = 0x1E84800
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB6_16
# %bb.17:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit83
	movq	8(%rsp), %rdi
	movl	$32000000, %edx                 # imm = 0x1E84800
	xorl	%esi, %esi
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB6_18
# %bb.19:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit85
	movq	%rbx, 32(%rsp)                  # 8-byte Spill
	movq	(%rsp), %rdi
	movl	$32000000, %edx                 # imm = 0x1E84800
	xorl	%esi, %esi
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB6_20
# %bb.21:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit87
	movabsq	$270582939711, %rbp             # imm = 0x3F0000003F
	movabsq	$137438953504, %r13             # imm = 0x2000000020
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %rbx
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r13, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_23
# %bb.22:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movl	$2000, %ecx                     # imm = 0x7D0
	callq	_Z34__device_stub__multiplyMatrixOnGPUPfS_S_i
.LBB6_23:
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	jne	.LBB6_24
# %bb.25:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit89
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	subq	%rbx, %rax
	cvtsi2ss	%rax, %xmm0
	divss	.LCPI6_0(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.15, %edi
	movb	$1, %al
	callq	printf
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB6_26
# %bb.27:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit91
	movq	8(%rsp), %rsi
	movl	$32000000, %edx                 # imm = 0x1E84800
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB6_28
# %bb.29:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit93
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %rbx
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r13, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_31
# %bb.30:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	(%rsp), %rdx
	movl	$2000, %ecx                     # imm = 0x7D0
	callq	_Z39__device_stub__multiplyMatrixOnGPUTilesPfS_S_i
.LBB6_31:
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	jne	.LBB6_32
# %bb.33:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit95
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	subq	%rbx, %rax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%rax, %xmm0
	divss	.LCPI6_0(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.18, %edi
	movb	$1, %al
	callq	printf
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB6_34
# %bb.35:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit99
	movq	(%rsp), %rsi
	movl	$32000000, %edx                 # imm = 0x1E84800
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	movq	32(%rsp), %rbx                  # 8-byte Reload
	jne	.LBB6_36
# %bb.37:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit101
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	$2000, %edx                     # imm = 0x7D0
	callq	_Z11checkResultPfS_i
	movq	24(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB6_38
# %bb.39:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit103
	movq	16(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB6_40
# %bb.41:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit105
	movq	8(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB6_42
# %bb.43:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit107
	movq	(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB6_44
# %bb.45:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit109
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	callq	hipDeviceReset
	testl	%eax, %eax
	jne	.LBB6_46
# %bb.47:                               # %_ZL15_safe_cuda_call10hipError_tPKcS1_i.exit111
	xorl	%eax, %eax
	addq	$1512, %rsp                     # imm = 0x5E8
	.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
.LBB6_1:
	.cfi_def_cfa_offset 1568
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.4, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$170, %r8d
	jmp	.LBB6_2
.LBB6_4:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.7, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$172, %r8d
	jmp	.LBB6_2
.LBB6_6:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.9, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$217, %r8d
	jmp	.LBB6_2
.LBB6_8:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.10, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$218, %r8d
	jmp	.LBB6_2
.LBB6_10:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.11, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$219, %r8d
	jmp	.LBB6_2
.LBB6_12:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.11, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$220, %r8d
	jmp	.LBB6_2
.LBB6_14:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.12, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$223, %r8d
	jmp	.LBB6_2
.LBB6_16:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.13, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$224, %r8d
	jmp	.LBB6_2
.LBB6_18:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.13, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$225, %r8d
	jmp	.LBB6_2
.LBB6_20:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.13, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$226, %r8d
	jmp	.LBB6_2
.LBB6_24:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.14, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$237, %r8d
	jmp	.LBB6_2
.LBB6_26:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.16, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$245, %r8d
	jmp	.LBB6_2
.LBB6_28:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.17, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$248, %r8d
	jmp	.LBB6_2
.LBB6_32:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.14, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$257, %r8d                      # imm = 0x101
	jmp	.LBB6_2
.LBB6_34:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.16, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$265, %r8d                      # imm = 0x109
	jmp	.LBB6_2
.LBB6_36:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.17, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$268, %r8d                      # imm = 0x10C
	jmp	.LBB6_2
.LBB6_38:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.19, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$275, %r8d                      # imm = 0x113
	jmp	.LBB6_2
.LBB6_40:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.19, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$276, %r8d                      # imm = 0x114
	jmp	.LBB6_2
.LBB6_42:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.19, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$277, %r8d                      # imm = 0x115
	jmp	.LBB6_2
.LBB6_44:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.19, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$278, %r8d                      # imm = 0x116
	jmp	.LBB6_2
.LBB6_46:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.21, %esi
	movl	$.L.str.20, %edx
	movl	$.L.str.5, %ecx
	movq	%rbx, %rdi
	movl	$289, %r8d                      # imm = 0x121
.LBB6_2:
	movq	%rax, %r9
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.Lfunc_end6:
	.size	main, .Lfunc_end6-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:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z19multiplyMatrixOnGPUPfS_S_i, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z24multiplyMatrixOnGPUTilesPfS_S_i, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"host %f gpu %f\n"
	.size	.L.str, 16

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

	.type	_Z24multiplyMatrixOnGPUTilesPfS_S_i,@object # @_Z24multiplyMatrixOnGPUTilesPfS_S_i
	.globl	_Z24multiplyMatrixOnGPUTilesPfS_S_i
	.p2align	3, 0x0
_Z24multiplyMatrixOnGPUTilesPfS_S_i:
	.quad	_Z39__device_stub__multiplyMatrixOnGPUTilesPfS_S_i
	.size	_Z24multiplyMatrixOnGPUTilesPfS_S_i, 8

	.type	.L.str.3,@object                # @.str.3
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.3:
	.asciz	"%s Starting...\n"
	.size	.L.str.3, 16

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Error device prop"
	.size	.L.str.4, 18

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/Programacion-multinucleo-2018/a-3-tilled-matrix-multiplication-legalgui/master/matrixMultiplicationTilesCompareGPU.hip"
	.size	.L.str.5, 181

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Using Device %d: %s\n"
	.size	.L.str.6, 21

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Error setting device"
	.size	.L.str.7, 21

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Matrix size: nx %d ny %d\n"
	.size	.L.str.8, 26

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Error allocating d_MatA"
	.size	.L.str.9, 24

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Error allocating d_MatB"
	.size	.L.str.10, 24

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Error allocating d_MatC"
	.size	.L.str.11, 24

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Error copying d_MatA"
	.size	.L.str.12, 21

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Error copying d_MatB"
	.size	.L.str.13, 21

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Error executing kernel"
	.size	.L.str.14, 23

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"multiplyMatrixOnGPU elapsed %f ms\n"
	.size	.L.str.15, 35

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"Error with last error"
	.size	.L.str.16, 22

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"Error copying d_MatC"
	.size	.L.str.17, 21

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"multiplyMatrixOnGPUTiles elapsed %f ms\n"
	.size	.L.str.18, 40

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"Error freeing memory"
	.size	.L.str.19, 21

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"Error reseting"
	.size	.L.str.20, 15

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"%s\n\nFile: %s\n\nLine Number: %d\n\nReason: %s\n"
	.size	.L.str.21, 43

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z19multiplyMatrixOnGPUPfS_S_i"
	.size	.L__unnamed_1, 31

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z24multiplyMatrixOnGPUTilesPfS_S_i"
	.size	.L__unnamed_2, 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	"Arrays do not match.\n"
	.size	.Lstr, 22

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Arrays match.\n"
	.size	.Lstr.1, 15

	.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 _Z34__device_stub__multiplyMatrixOnGPUPfS_S_i
	.addrsig_sym _Z39__device_stub__multiplyMatrixOnGPUTilesPfS_S_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z19multiplyMatrixOnGPUPfS_S_i
	.addrsig_sym _Z24multiplyMatrixOnGPUTilesPfS_S_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z19multiplyMatrixOnGPUPfS_S_i ; -- Begin function _Z19multiplyMatrixOnGPUPfS_S_i
	.globl	_Z19multiplyMatrixOnGPUPfS_S_i
	.p2align	8
	.type	_Z19multiplyMatrixOnGPUPfS_S_i,@function
_Z19multiplyMatrixOnGPUPfS_S_i:         ; @_Z19multiplyMatrixOnGPUPfS_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_waitcnt lgkmcnt(0)
	s_lshr_b32 s4, s3, 16
	s_and_b32 s3, s3, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	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_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_max_u32_e32 v2, v0, v1
	v_cmpx_gt_u32_e64 s2, v2
	s_cbranch_execz .LBB0_6
; %bb.1:                                ; %.preheader
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_mul_lo_u32 v5, v1, s2
	s_cmp_lt_i32 s2, 1
	s_cbranch_scc1 .LBB0_4
; %bb.2:                                ; %.lr.ph.preheader
	v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v3, v0
	v_mov_b32_e32 v6, 0
	s_mov_b32 s3, 0
.LBB0_3:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	v_dual_mov_b32 v4, v2 :: v_dual_add_nc_u32 v1, s3, v5
	s_add_i32 s3, s3, 1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_cmp_eq_u32 s2, s3
	v_lshlrev_b64 v[7:8], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[9:10], 2, v[3:4]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v7, vcc_lo, s4, v7
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v8, vcc_lo, s5, v8, vcc_lo
	v_add_co_u32 v9, vcc_lo, s6, v9
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v10, vcc_lo, s7, v10, vcc_lo
	global_load_b32 v1, v[7:8], off
	global_load_b32 v4, v[9:10], off
	s_waitcnt vmcnt(0)
	v_dual_fmac_f32 v6, v1, v4 :: v_dual_add_nc_u32 v3, s2, v3
	s_cbranch_scc0 .LBB0_3
	s_branch .LBB0_5
.LBB0_4:
	v_mov_b32_e32 v6, 0
.LBB0_5:                                ; %Flow42
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_mov_b32 v1, 0 :: v_dual_add_nc_u32 v0, v5, v0
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v6, off
.LBB0_6:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19multiplyMatrixOnGPUPfS_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 11
		.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	_Z19multiplyMatrixOnGPUPfS_S_i, .Lfunc_end0-_Z19multiplyMatrixOnGPUPfS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 328
; NumSgprs: 18
; NumVgprs: 11
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 11
; 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
	.protected	_Z24multiplyMatrixOnGPUTilesPfS_S_i ; -- Begin function _Z24multiplyMatrixOnGPUTilesPfS_S_i
	.globl	_Z24multiplyMatrixOnGPUTilesPfS_S_i
	.p2align	8
	.type	_Z24multiplyMatrixOnGPUTilesPfS_S_i,@function
_Z24multiplyMatrixOnGPUTilesPfS_S_i:    ; @_Z24multiplyMatrixOnGPUTilesPfS_S_i
; %bb.0:
	s_load_b32 s10, s[0:1], 0x18
	v_and_b32_e32 v3, 0x3ff, v0
	s_lshl_b32 s11, s14, 5
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[8:9], s[0:1], 0x10
	v_bfe_u32 v0, v0, 10, 10
	v_add_nc_u32_e32 v4, s11, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_lshl_add_u32 v5, s15, 5, v0
	s_waitcnt lgkmcnt(0)
	v_cvt_f32_i32_e32 v1, s10
	v_add_f32_e32 v1, 0x42000000, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v1, 0x3d000000, v1
	v_ceil_f32_e32 v1, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_i32_f32_e32 v7, v1
	v_cmp_gt_i32_e32 vcc_lo, 1, v7
	s_cbranch_vccnz .LBB1_11
; %bb.1:                                ; %.lr.ph
	v_dual_mov_b32 v6, 0 :: v_dual_lshlrev_b32 v1, 2, v3
	v_mul_lo_u32 v2, v0, s10
	v_dual_mov_b32 v17, v3 :: v_dual_lshlrev_b32 v8, 7, v0
	s_delay_alu instid0(VALU_DEP_3)
	v_or_b32_e32 v10, 0x1000, v1
	v_mul_lo_u32 v9, v5, s10
	v_cmp_gt_u32_e64 s2, s10, v5
	v_cmp_gt_u32_e64 s3, s10, v4
	v_add_nc_u32_e32 v11, v8, v1
	v_add3_u32 v1, v3, v2, s11
	v_add_nc_u32_e32 v12, v10, v8
	v_dual_mov_b32 v16, v0 :: v_dual_add_nc_u32 v13, 0x400, v10
	v_add_nc_u32_e32 v14, 0x800, v10
	v_add_nc_u32_e32 v15, 0xc00, v10
	s_lshl_b32 s11, s10, 5
.LBB1_2:                                ; =>This Inner Loop Header: Depth=1
	v_mov_b32_e32 v2, 0
	s_and_saveexec_b32 s12, s2
	s_cbranch_execz .LBB1_6
; %bb.3:                                ;   in Loop: Header=BB1_2 Depth=1
	v_mov_b32_e32 v2, 0
	s_mov_b32 s13, exec_lo
	v_cmpx_gt_u32_e64 s10, v17
	s_cbranch_execz .LBB1_5
; %bb.4:                                ;   in Loop: Header=BB1_2 Depth=1
	v_add_nc_u32_e32 v18, v9, v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v19, 31, v18
	v_lshlrev_b64 v[18:19], 2, v[18:19]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v18, vcc_lo, s4, v18
	v_add_co_ci_u32_e32 v19, vcc_lo, s5, v19, vcc_lo
	global_load_b32 v2, v[18:19], off
.LBB1_5:                                ; %Flow127
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s13
.LBB1_6:                                ;   in Loop: Header=BB1_2 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s12
	v_mov_b32_e32 v18, 0
	s_waitcnt vmcnt(0)
	ds_store_b32 v11, v2
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_and_saveexec_b32 s12, s3
	s_cbranch_execz .LBB1_10
; %bb.7:                                ;   in Loop: Header=BB1_2 Depth=1
	v_mov_b32_e32 v18, 0
	s_mov_b32 s13, exec_lo
	v_cmpx_gt_u32_e64 s10, v16
	s_cbranch_execz .LBB1_9
; %bb.8:                                ;   in Loop: Header=BB1_2 Depth=1
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[18:19], 2, v[1:2]
	v_add_co_u32 v18, vcc_lo, s6, v18
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v19, vcc_lo, s7, v19, vcc_lo
	global_load_b32 v18, v[18:19], off
.LBB1_9:                                ; %Flow
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s13
.LBB1_10:                               ;   in Loop: Header=BB1_2 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s12
	s_waitcnt vmcnt(0)
	ds_store_b32 v12, v18
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	ds_load_2addr_b32 v[26:27], v10 offset1:32
	ds_load_b128 v[18:21], v8
	ds_load_2addr_b32 v[28:29], v10 offset0:64 offset1:96
	ds_load_b128 v[22:25], v8 offset:16
	ds_load_2addr_b32 v[30:31], v10 offset0:128 offset1:160
	v_add_nc_u32_e32 v16, 32, v16
	v_add_nc_u32_e32 v7, -1, v7
	v_add_nc_u32_e32 v17, 32, v17
	v_add_nc_u32_e32 v1, s11, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_cmp_ne_u32_e32 vcc_lo, 0, v7
	s_and_b32 vcc_lo, exec_lo, vcc_lo
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v18, v26
	v_fmac_f32_e32 v6, v19, v27
	ds_load_2addr_b32 v[26:27], v10 offset0:192 offset1:224
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v20, v28
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v21, v29
	ds_load_2addr_b32 v[28:29], v13 offset1:32
	ds_load_b128 v[18:21], v8 offset:32
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v22, v30
	v_fmac_f32_e32 v6, v23, v31
	ds_load_2addr_b32 v[30:31], v13 offset0:64 offset1:96
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v24, v26
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v25, v27
	ds_load_b128 v[22:25], v8 offset:48
	ds_load_2addr_b32 v[26:27], v13 offset0:128 offset1:160
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v18, v28
	v_fmac_f32_e32 v6, v19, v29
	ds_load_2addr_b32 v[28:29], v13 offset0:192 offset1:224
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v20, v30
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v21, v31
	ds_load_2addr_b32 v[30:31], v14 offset1:32
	ds_load_b128 v[18:21], v8 offset:64
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v22, v26
	v_fmac_f32_e32 v6, v23, v27
	ds_load_2addr_b32 v[26:27], v14 offset0:64 offset1:96
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v24, v28
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v25, v29
	ds_load_b128 v[22:25], v8 offset:80
	ds_load_2addr_b32 v[28:29], v14 offset0:128 offset1:160
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v18, v30
	v_fmac_f32_e32 v6, v19, v31
	ds_load_2addr_b32 v[30:31], v14 offset0:192 offset1:224
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v20, v26
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v21, v27
	ds_load_2addr_b32 v[26:27], v15 offset1:32
	ds_load_b128 v[18:21], v8 offset:96
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v22, v28
	v_fmac_f32_e32 v6, v23, v29
	ds_load_2addr_b32 v[28:29], v15 offset0:64 offset1:96
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v24, v30
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v25, v31
	ds_load_b128 v[22:25], v8 offset:112
	ds_load_2addr_b32 v[30:31], v15 offset0:128 offset1:160
	s_waitcnt lgkmcnt(3)
	v_fmac_f32_e32 v6, v18, v26
	v_fmac_f32_e32 v6, v19, v27
	ds_load_2addr_b32 v[18:19], v15 offset0:192 offset1:224
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_fmac_f32_e32 v6, v20, v28
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v21, v29
	v_fmac_f32_e32 v6, v22, v30
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v23, v31
	v_fmac_f32_e32 v6, v24, v18
	s_delay_alu instid0(VALU_DEP_1)
	v_fmac_f32_e32 v6, v25, v19
	s_cbranch_vccnz .LBB1_2
	s_branch .LBB1_12
.LBB1_11:
	v_mov_b32_e32 v6, 0
.LBB1_12:                               ; %._crit_edge
	v_max_u32_e32 v1, v4, v5
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_u32_e64 s10, v1
	s_cbranch_execz .LBB1_14
; %bb.13:
	s_load_b32 s0, s[0:1], 0x2c
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s1, s0, 16
	s_and_b32 s0, s0, 0xffff
	v_mad_u64_u32 v[1:2], null, s15, s1, v[0:1]
	s_mul_i32 s14, s14, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v0, v1, s10
	v_mov_b32_e32 v1, 0
	v_add3_u32 v0, s14, v3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	v_add_co_u32 v0, vcc_lo, s8, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s9, v1, vcc_lo
	global_store_b32 v[0:1], v6, off
.LBB1_14:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z24multiplyMatrixOnGPUTilesPfS_S_i
		.amdhsa_group_segment_fixed_size 8192
		.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 32
		.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_end1:
	.size	_Z24multiplyMatrixOnGPUTilesPfS_S_i, .Lfunc_end1-_Z24multiplyMatrixOnGPUTilesPfS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1044
; NumSgprs: 18
; NumVgprs: 32
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 8192 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 3
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 32
; 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:           _Z19multiplyMatrixOnGPUPfS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z19multiplyMatrixOnGPUPfS_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     11
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .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: 8192
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z24multiplyMatrixOnGPUTilesPfS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z24multiplyMatrixOnGPUTilesPfS_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     32
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
