
#include <cstdio>
#include <cstdlib>
#include <random>
#include <sys/time.h>
#include "kernel.cuh"

#define cudaErrChk(ans) { cudaAssert((ans), __FILE__, __LINE__); }
inline void cudaAssert(cudaError_t code, const char *file, int line, bool abort=true)
{
   if (code != cudaSuccess) 
   {
      fprintf(stderr,"CUDA assert: %s %s %d\n", cudaGetErrorString(code), file, line);
      if (abort) exit(code);
   }
}

int loop_exe = 1;

void matmul_serial (const float *A, const float *B, float *C, const int len) {
    printf("[CPU] Kernel start..\n");
    

    timeval st, ed;
    gettimeofday(&st, NULL);
    // Main body
    for (int i=0; i<len; i++) {
        for (int j=0; j<len; j++) {
            float sum = 0;
            for (int k=0; k<len; k++) {
                sum += A[i*len+k]*B[k*len+j];
            }
            C[i*len+j] = sum;
        }
    }
    // End of main body
    gettimeofday(&ed, NULL);

    float time = (ed.tv_sec - st.tv_sec) + ((ed.tv_usec-st.tv_usec)*1e-6);
    float gops = 1.0*len*len*len*1e-9;
    printf("    Total number of floating point multiplications : %.2fGops\n", gops);
    printf("    Elaped time: %.4f\n", time);
    printf("    GFLOPS : %.4f [Avg. of %d time(s)]\n", gops*loop_exe/time, loop_exe); 

}


void matmul_cuda_basic (const float *A, const float *B, float *C, const int len) {

    /***
      CUDA implementataion without any optimization methods
      **/
    const int num_threads = 16;
    const dim3 dim_threads(num_threads, num_threads);
    const dim3 dim_blocks((len+num_threads-1)/num_threads, (len+num_threads-1)/num_threads);
    printf("[GPU] Basic kernel start..\n");
    printf("    Grid size: [(%d, %d), (%d, %d)]\n", dim_blocks.y, dim_blocks.x, dim_threads.y, dim_threads.x);


    /*** Memcpy H to D ***/
    float *d_A, *d_B, *d_C;
    cudaErrChk (cudaMalloc ((void **)&d_A, sizeof(float)*len*len));
    cudaErrChk (cudaMalloc ((void **)&d_B, sizeof(float)*len*len));
    cudaErrChk (cudaMalloc ((void **)&d_C, sizeof(float)*len*len));
    cudaErrChk (cudaMemcpy (d_A, A, sizeof(float)*len*len, cudaMemcpyHostToDevice));
    cudaErrChk (cudaMemcpy (d_B, B, sizeof(float)*len*len, cudaMemcpyHostToDevice));
    

    float gops = 1.0*len*len*len*1e-9*loop_exe;
    float msec_total = 0.0f;
    cudaEvent_t start, stop;
    cudaErrChk (cudaEventCreate(&start));
    cudaErrChk (cudaEventCreate(&stop));
    cudaErrChk (cudaEventRecord(start, NULL));
    // Main body
    for (int i=0; i<loop_exe; i++) {
        matmul_basic<<<dim_blocks, dim_threads>>>(d_A, d_B, d_C, len);
        cudaErrChk (cudaDeviceSynchronize ())
        cudaErrChk( cudaGetLastError() );
    }
    // End of main body
    cudaErrChk (cudaEventRecord(stop, NULL));
    cudaErrChk (cudaEventSynchronize(stop));
    cudaErrChk (cudaEventElapsedTime(&msec_total, start, stop));


    printf("    Total number of floating point multiplications : %.2f Gops\n", gops);
    printf("    Elaped time: %.4f msec\n", msec_total);
    printf("    GFLOPS : %.4f [Avg. of %d time(s)]\n", gops/(msec_total*1e-3), loop_exe); 

    cudaErrChk (cudaMemcpy(C, d_C, sizeof(float)*len*len, cudaMemcpyDeviceToHost));
    cudaErrChk (cudaDeviceSynchronize ())
    cudaErrChk (cudaFree (d_A));
    cudaErrChk (cudaFree (d_B));
    cudaErrChk (cudaFree (d_C));

}



void matmul_cuda_shared (const float *A, const float *B, float *C, const int len) {

    /***
      CUDA implementataion without any optimization methods
      **/
    const int len_tile = 16;
    const dim3 dim_threads(len_tile, len_tile);
    const dim3 dim_blocks((len+len_tile-1)/len_tile, (len+len_tile-1)/len_tile);
    const int size_smem = 2*sizeof(float)*len_tile*len_tile;
    printf("[GPU] Kernel with shared memory start..\n");
    printf("    Grid size: [(%d, %d), (%d, %d)]\n", dim_blocks.y, dim_blocks.x, dim_threads.y, dim_threads.x);
    printf("    Shared mem size: %.2fKB\n", size_smem/1024.0);


    /*** Memcpy H to D ***/
    float *d_A, *d_B, *d_C;
    cudaErrChk (cudaMalloc ((void **)&d_A, sizeof(float)*len*len));
    cudaErrChk (cudaMalloc ((void **)&d_B, sizeof(float)*len*len));
    cudaErrChk (cudaMalloc ((void **)&d_C, sizeof(float)*len*len));
    cudaErrChk (cudaMemcpy (d_A, A, sizeof(float)*len*len, cudaMemcpyHostToDevice));
    cudaErrChk (cudaMemcpy (d_B, B, sizeof(float)*len*len, cudaMemcpyHostToDevice));
    

    float gops = 1.0*len*len*len*1e-9*loop_exe;
    float msec_total = 0.0f;
    cudaEvent_t start, stop;
    cudaErrChk(cudaEventCreate(&start));
    cudaErrChk(cudaEventCreate(&stop));
    cudaErrChk(cudaEventRecord(start, NULL));
    // Main body
    for (int i=0; i<loop_exe; i++) {
        matmul_tiled<<<dim_blocks, dim_threads, size_smem>>>(d_A, d_B, d_C, len, len_tile);
        cudaErrChk (cudaDeviceSynchronize ())
        cudaErrChk( cudaGetLastError() );
    }
    // End of main body
    cudaErrChk(cudaEventRecord(stop, NULL));
    cudaErrChk(cudaEventSynchronize(stop));
    cudaErrChk(cudaEventElapsedTime(&msec_total, start, stop));

    printf("    Total number of floating point multiplications : %.2f Gops\n", gops);
    printf("    Elaped time: %.4f msec\n", msec_total);
    printf("    GFLOPS : %.4f [Avg. of %d time(s)]\n", gops/(msec_total*1e-3), loop_exe); 

    cudaErrChk (cudaMemcpy(C, d_C, sizeof(float)*len*len, cudaMemcpyDeviceToHost));
    cudaErrChk (cudaDeviceSynchronize ())
    cudaErrChk (cudaFree (d_A));
    cudaErrChk (cudaFree (d_B));
    cudaErrChk (cudaFree (d_C));

}


void matmul_cuda_shared_transposed (const float *A, const float *B, float *C, const int len) {

    /***
      CUDA implementataion without any optimization methods
      **/
    const int len_tile = 16;
    const dim3 dim_threads(len_tile, len_tile);
    const dim3 dim_blocks((len+len_tile-1)/len_tile, (len+len_tile-1)/len_tile);
    const int size_smem = 2*sizeof(float)*len_tile*len_tile;
    printf("[GPU] Kernel with shared transposed start..\n");
    printf("    Grid size: [(%d, %d), (%d, %d)]\n", dim_blocks.y, dim_blocks.x, dim_threads.y, dim_threads.x);
    printf("    Shared mem size: %.2fKB\n", size_smem/1024.0);


    /*** Memcpy H to D ***/
    float *d_A, *d_A_T, *d_B, *d_C;
    cudaErrChk (cudaMalloc ((void **)&d_A, sizeof(float)*len*len));
    cudaErrChk (cudaMalloc ((void **)&d_A_T, sizeof(float)*len*len));
    cudaErrChk (cudaMalloc ((void **)&d_B, sizeof(float)*len*len));
    cudaErrChk (cudaMalloc ((void **)&d_C, sizeof(float)*len*len));
    cudaErrChk (cudaMemcpy (d_A, A, sizeof(float)*len*len, cudaMemcpyHostToDevice));
    transpose<<<dim_blocks, dim_threads>>>(d_A, d_A_T, len);
    cudaErrChk (cudaMemcpy (d_B, B, sizeof(float)*len*len, cudaMemcpyHostToDevice));
    

    float gops = 1.0*len*len*len*1e-9*loop_exe;
    float msec_total = 0.0f;
    cudaEvent_t start, stop;
    cudaErrChk(cudaEventCreate(&start));
    cudaErrChk(cudaEventCreate(&stop));
    cudaErrChk(cudaEventRecord(start, NULL));
    // Main body
    for (int i=0; i<loop_exe; i++) {
        matmul_tiled_transposed<<<dim_blocks, dim_threads, size_smem>>>(d_A_T, d_B, d_C, len, len_tile);
        cudaErrChk (cudaDeviceSynchronize ())
        cudaErrChk( cudaGetLastError() );
    }
    // End of main body
    cudaErrChk(cudaEventRecord(stop, NULL));
    cudaErrChk(cudaEventSynchronize(stop));
    cudaErrChk(cudaEventElapsedTime(&msec_total, start, stop));

    printf("    Total number of floating point multiplications : %.2f Gops\n", gops);
    printf("    Elaped time: %.4f msec\n", msec_total);
    printf("    GFLOPS : %.4f [Avg. of %d time(s)]\n", gops/(msec_total*1e-3), loop_exe); 

    cudaErrChk (cudaMemcpy(C, d_C, sizeof(float)*len*len, cudaMemcpyDeviceToHost));
    cudaErrChk (cudaDeviceSynchronize ())
    cudaErrChk (cudaFree (d_A));
    cudaErrChk (cudaFree (d_A_T));
    cudaErrChk (cudaFree (d_B));
    cudaErrChk (cudaFree (d_C));

}

/****************************************
  ************** Host Code **************
  ****************************************/

void h_initialize(float *mem, const int len) {
    for (int i=0; i<len; i++) {
        for (int j=0; j<len; j++) {
            mem[i*len+j] = (float)(rand()%1000);
        }
    }
}

bool h_test(const float *A, const float *B, const float *C, const int len) {
    printf("[TEST] Test start..\n");
    for (int i=0; i<len; i++) {
        for (int j=0; j<len; j++) {
            float sum = 0;
            for (int k=0; k<len; k++) {
                sum += A[i*len+k]*B[k*len+j];
            }
            if (sum != C[i*len+j]){
                printf("C[%d][%d] = %.f != %f\n", i, j, C[i*len+j], sum);
                return false;
            }
        }
    }
    return true;
}


int main(int argc, char** argv) {

    /*** Program configuration ***/
    printf("\n============================================\n");
    printf("Matrix multiplication\n");
    printf("    A * B = C\n");
    printf("    arg : ./matmul [len] [Test:0,1] [loop_exe]\n");
    printf("============================================\n\n");
    int len = (int)1e+4;
    if (argc >= 2) 
        len = atoi(argv[1]);
    if (argc >= 4) 
        loop_exe = atoi(argv[3]);
    srand(0);

    /*** Data initialize ***/
    float *A = (float *) malloc (len*len*sizeof(float));
    float *B = (float *) malloc (len*len*sizeof(float));
    float *C = (float *) calloc (len*len,sizeof(float));
    h_initialize(A, len);
    h_initialize(B, len);
    printf("[Mem] Size of a matrix : [%d, %d]\n", len, len);
    printf("[Mem] Total size of matrices : %.3fGB\n", 3.0*len*len*sizeof(float)*1e-9);


    /*** Run a matmul ***/
//    matmul_serial (A, B, C, len);
    matmul_cuda_basic (A, B, C, len);
    matmul_cuda_shared (A, B, C, len);
    matmul_cuda_shared_transposed (A, B, C, len);

    /*** Test the result ***/
    if (argc >= 3 && atoi(argv[2]) == 1) {
        if (h_test (A, B, C, len) == true) {
            printf("    Test passed\n");
        } else {
            printf("    [ERR] Test failed!!\n");
        }
    } else {
        printf("[TEST] Test skipped..\n");
    }

    /*** Finalize ***/
    free (A);
    free (B);
    free (C);


    printf("============================================\n\n");
    return 0;
}



	.file	"tmpxft_00207035_00000000-6_matmul.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4118:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4118:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata._Z10cudaAssert9cudaErrorPKcib.str1.1,"aMS",@progbits,1
.LC0:
	.string	"CUDA assert: %s %s %d\n"
	.section	.text._Z10cudaAssert9cudaErrorPKcib,"axG",@progbits,_Z10cudaAssert9cudaErrorPKcib,comdat
	.weak	_Z10cudaAssert9cudaErrorPKcib
	.type	_Z10cudaAssert9cudaErrorPKcib, @function
_Z10cudaAssert9cudaErrorPKcib:
.LFB4108:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L8
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edi, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movl	%edx, 12(%rsp)
	movq	%rsi, (%rsp)
	call	cudaGetErrorString@PLT
	movl	12(%rsp), %r9d
	movq	(%rsp), %r8
	leaq	.LC0(%rip), %rdx
	movq	stderr(%rip), %rdi
	movq	%rax, %rcx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	testb	%bpl, %bpl
	je	.L2
	movl	%ebx, %edi
	call	exit@PLT
.L2:
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE4108:
	.size	_Z10cudaAssert9cudaErrorPKcib, .-_Z10cudaAssert9cudaErrorPKcib
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"[CPU] Kernel start..\n"
.LC5:
	.string	"    Total number of floating point multiplications : %.2fGops\n"
.LC6:
	.string	"    Elaped time: %.4f\n"
.LC7:
	.string	"    GFLOPS : %.4f [Avg. of %d time(s)]\n"
	.text
	.globl	_Z13matmul_serialPKfS0_Pfi
	.type	_Z13matmul_serialPKfS0_Pfi, @function
_Z13matmul_serialPKfS0_Pfi:
.LFB4109:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	leaq	.LC2(%rip), %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	movl	$2, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movl	%ecx, %ebx
	subq	$72, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	gettimeofday@PLT
	movslq	%ebx, %rcx
	xorl	%edx, %edx
	xorl	%edi, %edi
	salq	$2, %rcx
.L13:
	cmpl	%ebx, %edi
	jge	.L21
	xorl	%eax, %eax
	leaq	0(%rbp,%rdx), %r9
	leaq	0(%r13,%rdx), %r10
.L16:
	leaq	(%r12,%rax,4), %r8
	xorl	%esi, %esi
	xorps	%xmm0, %xmm0
.L14:
	movss	(%r9,%rsi,4), %xmm1
	mulss	(%r8), %xmm1
	incq	%rsi
	addq	%rcx, %r8
	addss	%xmm1, %xmm0
	cmpl	%esi, %ebx
	jg	.L14
	movss	%xmm0, (%r10,%rax,4)
	incq	%rax
	cmpl	%eax, %ebx
	jg	.L16
	incl	%edi
	addq	%rcx, %rdx
	jmp	.L13
.L21:
	xorl	%esi, %esi
	leaq	40(%rsp), %rdi
	call	gettimeofday@PLT
	movq	48(%rsp), %rax
	subq	32(%rsp), %rax
	leaq	.LC5(%rip), %rsi
	cvtsi2sdq	%rax, %xmm0
	movq	40(%rsp), %rax
	subq	24(%rsp), %rax
	movl	$2, %edi
	mulsd	.LC3(%rip), %xmm0
	cvtsi2sdq	%rax, %xmm1
	movb	$1, %al
	addsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm2
	cvtsi2sdl	%ebx, %xmm0
	movss	%xmm2, 8(%rsp)
	movaps	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	mulsd	.LC4(%rip), %xmm1
	cvtsd2ss	%xmm1, %xmm1
	cvtss2sd	%xmm1, %xmm0
	movss	%xmm1, 12(%rsp)
	call	__printf_chk@PLT
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	8(%rsp), %xmm0
	call	__printf_chk@PLT
	movl	$2, %edi
	movb	$1, %al
	movl	loop_exe(%rip), %edx
	movss	12(%rsp), %xmm1
	leaq	.LC7(%rip), %rsi
	cvtsi2ssl	%edx, %xmm0
	mulss	%xmm1, %xmm0
	divss	8(%rsp), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	addq	$72, %rsp
	.cfi_def_cfa_offset 40
	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
.LFE4109:
	.size	_Z13matmul_serialPKfS0_Pfi, .-_Z13matmul_serialPKfS0_Pfi
	.section	.rodata.str1.1
.LC8:
	.string	"[GPU] Basic kernel start..\n"
.LC9:
	.string	"    Grid size: [(%d, %d), (%d, %d)]\n"
.LC10:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/jhson989/cuda_study/main/basic/mat_mul/matmul.cu"
.LC11:
	.string	"    Total number of floating point multiplications : %.2f Gops\n"
.LC12:
	.string	"    Elaped time: %.4f msec\n"
	.text
	.globl	_Z17matmul_cuda_basicPKfS0_Pfi
	.type	_Z17matmul_cuda_basicPKfS0_Pfi, @function
_Z17matmul_cuda_basicPKfS0_Pfi:
.LFB4110:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	movl	$2, %edi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	leaq	.LC8(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leal	15(%rcx), %eax
	movl	$16, %ecx
	movl	$1, 72(%rsp)
	cltd
	movl	$1, 84(%rsp)
	idivl	%ecx
	movl	%eax, %ebx
	movl	%eax, 76(%rsp)
	movl	%eax, 80(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$16, %r9d
	movl	%ebx, %ecx
	movl	%ebx, %edx
	movl	$16, %r8d
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movslq	%ebp, %rax
	leaq	24(%rsp), %rdi
	leaq	.LC10(%rip), %rbx
	imulq	%rax, %rax
	leaq	0(,%rax,4), %r15
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	movl	$1, %ecx
	movl	$62, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	leaq	32(%rsp), %rdi
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	movl	$1, %ecx
	movl	$63, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	leaq	40(%rsp), %rdi
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	movl	$1, %ecx
	movl	$64, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	24(%rsp), %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movabsq	$68719476752, %r14
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$65, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	32(%rsp), %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r13d, %r13d
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$66, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	cvtsi2sdl	%ebp, %xmm1
	leaq	48(%rsp), %rdi
	movl	$0x00000000, 20(%rsp)
	movaps	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	cvtsi2sdl	loop_exe(%rip), %xmm1
	mulsd	.LC4(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm2
	movss	%xmm2, 12(%rsp)
	call	cudaEventCreate@PLT
	movl	$1, %ecx
	movl	$72, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	leaq	56(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$1, %ecx
	movl	$73, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$1, %ecx
	movl	$74, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
.L23:
	cmpl	%r13d, loop_exe(%rip)
	jle	.L28
	movl	72(%rsp), %ecx
	movq	76(%rsp), %rdi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	84(%rsp), %esi
	movq	%r14, %rdx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L24
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	%ebp, %ecx
	movq	24(%rsp), %rdi
	call	_Z12matmul_basicPKfS0_Pfi@PLT
.L24:
	call	cudaDeviceSynchronize@PLT
	movl	$1, %ecx
	movq	%rbx, %rsi
	incl	%r13d
	movl	%eax, %edi
	movl	$78, %edx
	call	_Z10cudaAssert9cudaErrorPKcib
	call	cudaGetLastError@PLT
	movl	$1, %ecx
	movl	$79, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	jmp	.L23
.L28:
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$1, %ecx
	movl	$82, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movl	$1, %ecx
	movl	$83, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	20(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movl	$1, %ecx
	movl	$84, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	cvtss2sd	12(%rsp), %xmm3
	leaq	.LC11(%rip), %rsi
	movaps	%xmm3, %xmm0
	movl	$2, %edi
	movb	$1, %al
	movq	%xmm3, %rbp
	call	__printf_chk@PLT
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	20(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	%rbp, %xmm0
	movb	$1, %al
	cvtss2sd	20(%rsp), %xmm1
	movl	loop_exe(%rip), %edx
	movl	$2, %edi
	leaq	.LC7(%rip), %rsi
	mulsd	.LC13(%rip), %xmm1
	divsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	movq	40(%rsp), %rsi
	movq	%r15, %rdx
	movq	%r12, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$91, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	call	cudaDeviceSynchronize@PLT
	movl	$1, %ecx
	movl	$92, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movl	$1, %ecx
	movl	$93, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movl	$1, %ecx
	movl	$94, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movl	$1, %ecx
	movl	$95, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	addq	$104, %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
	ret
	.cfi_endproc
.LFE4110:
	.size	_Z17matmul_cuda_basicPKfS0_Pfi, .-_Z17matmul_cuda_basicPKfS0_Pfi
	.section	.rodata.str1.1
.LC14:
	.string	"[GPU] Kernel with shared memory start..\n"
.LC16:
	.string	"    Shared mem size: %.2fKB\n"
	.text
	.globl	_Z18matmul_cuda_sharedPKfS0_Pfi
	.type	_Z18matmul_cuda_sharedPKfS0_Pfi, @function
_Z18matmul_cuda_sharedPKfS0_Pfi:
.LFB4111:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	movl	$2, %edi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	leaq	.LC14(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leal	15(%rcx), %eax
	movl	$16, %ecx
	movl	$1, 72(%rsp)
	cltd
	movl	$1, 84(%rsp)
	idivl	%ecx
	movl	%eax, %ebx
	movl	%eax, 76(%rsp)
	movl	%eax, 80(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$16, %r9d
	movl	%ebx, %ecx
	movl	%ebx, %edx
	movl	$16, %r8d
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movsd	.LC15(%rip), %xmm0
	leaq	.LC16(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	leaq	.LC10(%rip), %rbx
	call	__printf_chk@PLT
	movslq	%ebp, %rax
	leaq	24(%rsp), %rdi
	imulq	%rax, %rax
	leaq	0(,%rax,4), %r15
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	movl	$1, %ecx
	movl	$117, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	leaq	32(%rsp), %rdi
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	movl	$1, %ecx
	movl	$118, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	leaq	40(%rsp), %rdi
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	movl	$1, %ecx
	movl	$119, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	24(%rsp), %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movabsq	$68719476752, %r14
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$120, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	32(%rsp), %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r13d, %r13d
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$121, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	cvtsi2sdl	%ebp, %xmm1
	leaq	48(%rsp), %rdi
	movl	$0x00000000, 20(%rsp)
	movaps	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	cvtsi2sdl	loop_exe(%rip), %xmm1
	mulsd	.LC4(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm2
	movss	%xmm2, 12(%rsp)
	call	cudaEventCreate@PLT
	movl	$1, %ecx
	movl	$127, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	leaq	56(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$1, %ecx
	movl	$128, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$1, %ecx
	movl	$129, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
.L30:
	cmpl	%r13d, loop_exe(%rip)
	jle	.L35
	movl	72(%rsp), %ecx
	movq	76(%rsp), %rdi
	xorl	%r9d, %r9d
	movq	%r14, %rdx
	movl	84(%rsp), %esi
	movl	$2048, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L31
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$16, %r8d
	movl	%ebp, %ecx
	movq	24(%rsp), %rdi
	call	_Z12matmul_tiledPKfS0_Pfii@PLT
.L31:
	call	cudaDeviceSynchronize@PLT
	movl	$1, %ecx
	movq	%rbx, %rsi
	incl	%r13d
	movl	%eax, %edi
	movl	$133, %edx
	call	_Z10cudaAssert9cudaErrorPKcib
	call	cudaGetLastError@PLT
	movl	$1, %ecx
	movl	$134, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	jmp	.L30
.L35:
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$1, %ecx
	movl	$137, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movl	$1, %ecx
	movl	$138, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	20(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movl	$1, %ecx
	movl	$139, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	cvtss2sd	12(%rsp), %xmm3
	leaq	.LC11(%rip), %rsi
	movaps	%xmm3, %xmm0
	movl	$2, %edi
	movb	$1, %al
	movq	%xmm3, %rbp
	call	__printf_chk@PLT
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	20(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	%rbp, %xmm0
	movb	$1, %al
	cvtss2sd	20(%rsp), %xmm1
	movl	loop_exe(%rip), %edx
	movl	$2, %edi
	leaq	.LC7(%rip), %rsi
	mulsd	.LC13(%rip), %xmm1
	divsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	movq	40(%rsp), %rsi
	movq	%r15, %rdx
	movq	%r12, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$145, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	call	cudaDeviceSynchronize@PLT
	movl	$1, %ecx
	movl	$146, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movl	$1, %ecx
	movl	$147, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movl	$1, %ecx
	movl	$148, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movl	$1, %ecx
	movl	$149, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	addq	$104, %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
	ret
	.cfi_endproc
.LFE4111:
	.size	_Z18matmul_cuda_sharedPKfS0_Pfi, .-_Z18matmul_cuda_sharedPKfS0_Pfi
	.section	.rodata.str1.1
.LC17:
	.string	"[GPU] Kernel with shared transposed start..\n"
	.text
	.globl	_Z29matmul_cuda_shared_transposedPKfS0_Pfi
	.type	_Z29matmul_cuda_shared_transposedPKfS0_Pfi, @function
_Z29matmul_cuda_shared_transposedPKfS0_Pfi:
.LFB4112:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdi, %r15
	movl	$2, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	leaq	.LC17(%rip), %rsi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movslq	%ecx, %rbp
	movl	$16, %ecx
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %r12
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leal	15(%rbp), %eax
	movl	$1, 84(%rsp)
	cltd
	imulq	%rbp, %rbp
	idivl	%ecx
	salq	$2, %rbp
	movl	%eax, %ebx
	movl	%eax, 76(%rsp)
	movl	%eax, 80(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$16, %r9d
	movl	%ebx, %ecx
	movl	%ebx, %edx
	movl	$16, %r8d
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movsd	.LC15(%rip), %xmm0
	leaq	.LC16(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	leaq	.LC10(%rip), %rbx
	call	__printf_chk@PLT
	leaq	16(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movl	$1, %ecx
	movl	$170, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	leaq	24(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movl	$1, %ecx
	movl	$171, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	leaq	32(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movl	$1, %ecx
	movl	$172, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	leaq	40(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movl	$1, %ecx
	movl	$173, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	16(%rsp), %rdi
	movq	%rbp, %rdx
	movq	%r15, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$174, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	76(%rsp), %rdi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	84(%rsp), %esi
	movl	$1, %ecx
	movabsq	$68719476752, %rdx
	movl	$1, 72(%rsp)
	movq	%rdx, 64(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L37
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	%r12d, %edx
	call	_Z9transposePKfPfi@PLT
.L37:
	movq	32(%rsp), %rdi
	movq	%r14, %rsi
	movl	$1, %ecx
	movq	%rbp, %rdx
	xorl	%r15d, %r15d
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$176, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	cvtsi2sdl	%r12d, %xmm1
	leaq	48(%rsp), %rdi
	movl	$0x00000000, 12(%rsp)
	movaps	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	cvtsi2sdl	loop_exe(%rip), %xmm1
	mulsd	.LC4(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm2
	movd	%xmm2, %r14d
	call	cudaEventCreate@PLT
	movl	$1, %ecx
	movl	$182, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	leaq	56(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$1, %ecx
	movl	$183, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$1, %ecx
	movl	$184, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
.L38:
	cmpl	%r15d, loop_exe(%rip)
	jle	.L43
	movl	72(%rsp), %ecx
	movq	64(%rsp), %rdx
	xorl	%r9d, %r9d
	movl	$2048, %r8d
	movq	76(%rsp), %rdi
	movl	84(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L39
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$16, %r8d
	movl	%r12d, %ecx
	movq	24(%rsp), %rdi
	call	_Z23matmul_tiled_transposedPKfS0_Pfii@PLT
.L39:
	call	cudaDeviceSynchronize@PLT
	movl	$1, %ecx
	movq	%rbx, %rsi
	incl	%r15d
	movl	%eax, %edi
	movl	$188, %edx
	call	_Z10cudaAssert9cudaErrorPKcib
	call	cudaGetLastError@PLT
	movl	$1, %ecx
	movl	$189, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	jmp	.L38
.L43:
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$1, %ecx
	movl	$192, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movl	$1, %ecx
	movl	$193, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	12(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movl	$1, %ecx
	movl	$194, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movd	%r14d, %xmm4
	leaq	.LC11(%rip), %rsi
	movb	$1, %al
	cvtss2sd	%xmm4, %xmm3
	movl	$2, %edi
	movaps	%xmm3, %xmm0
	movq	%xmm3, %r14
	call	__printf_chk@PLT
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	12(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	%r14, %xmm0
	movb	$1, %al
	cvtss2sd	12(%rsp), %xmm1
	movl	loop_exe(%rip), %edx
	movl	$2, %edi
	leaq	.LC7(%rip), %rsi
	mulsd	.LC13(%rip), %xmm1
	divsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	movq	40(%rsp), %rsi
	movq	%rbp, %rdx
	movq	%r13, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	movl	$200, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	call	cudaDeviceSynchronize@PLT
	movl	$1, %ecx
	movl	$201, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movl	$1, %ecx
	movl	$202, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movl	$1, %ecx
	movl	$203, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movl	$1, %ecx
	movl	$204, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movl	$1, %ecx
	movl	$205, %edx
	movq	%rbx, %rsi
	movl	%eax, %edi
	call	_Z10cudaAssert9cudaErrorPKcib
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L41
	call	__stack_chk_fail@PLT
.L41:
	addq	$104, %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
	ret
	.cfi_endproc
.LFE4112:
	.size	_Z29matmul_cuda_shared_transposedPKfS0_Pfi, .-_Z29matmul_cuda_shared_transposedPKfS0_Pfi
	.globl	_Z12h_initializePfi
	.type	_Z12h_initializePfi, @function
_Z12h_initializePfi:
.LFB4113:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	$1000, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movslq	%esi, %r13
	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
	movq	%r13, %rbp
	salq	$2, %r13
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	pushq	%rdx
	.cfi_def_cfa_offset 64
.L45:
	cmpl	%ebp, %r12d
	jge	.L50
	leaq	(%rbx,%r13), %r15
.L46:
	call	rand@PLT
	addq	$4, %rbx
	cltd
	idivl	%r14d
	cvtsi2ssl	%edx, %xmm0
	movss	%xmm0, -4(%rbx)
	cmpq	%r15, %rbx
	jne	.L46
	incl	%r12d
	jmp	.L45
.L50:
	popq	%rax
	.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
	ret
	.cfi_endproc
.LFE4113:
	.size	_Z12h_initializePfi, .-_Z12h_initializePfi
	.section	.rodata.str1.1
.LC18:
	.string	"[TEST] Test start..\n"
.LC19:
	.string	"C[%d][%d] = %.f != %f\n"
	.text
	.globl	_Z6h_testPKfS0_S0_i
	.type	_Z6h_testPKfS0_S0_i, @function
_Z6h_testPKfS0_S0_i:
.LFB4114:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorl	%eax, %eax
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	leaq	.LC18(%rip), %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	movl	$2, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movl	%ecx, %ebx
	pushq	%r8
	.cfi_def_cfa_offset 48
	call	__printf_chk@PLT
	movslq	%ebx, %rax
	xorl	%esi, %esi
	xorl	%edx, %edx
	salq	$2, %rax
.L52:
	cmpl	%ebx, %edx
	jge	.L63
	xorl	%ecx, %ecx
	leaq	0(%rbp,%rsi), %r9
	leaq	0(%r13,%rsi), %r10
.L58:
	leaq	(%r12,%rcx,4), %r8
	xorl	%edi, %edi
	xorps	%xmm1, %xmm1
.L53:
	movss	(%r9,%rdi,4), %xmm0
	mulss	(%r8), %xmm0
	incq	%rdi
	addq	%rax, %r8
	addss	%xmm0, %xmm1
	cmpl	%edi, %ebx
	jg	.L53
	movss	(%r10,%rcx,4), %xmm0
	ucomiss	%xmm1, %xmm0
	jp	.L60
	je	.L54
.L60:
	movl	$2, %edi
	movb	$2, %al
	cvtss2sd	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm1
	leaq	.LC19(%rip), %rsi
	call	__printf_chk@PLT
	xorl	%eax, %eax
	jmp	.L51
.L54:
	incq	%rcx
	cmpl	%ecx, %ebx
	jg	.L58
	incl	%edx
	addq	%rax, %rsi
	jmp	.L52
.L63:
	movb	$1, %al
.L51:
	popq	%rdx
	.cfi_def_cfa_offset 40
	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
.LFE4114:
	.size	_Z6h_testPKfS0_S0_i, .-_Z6h_testPKfS0_S0_i
	.section	.rodata.str1.1
.LC20:
	.string	"\n============================================\n"
.LC21:
	.string	"Matrix multiplication\n"
.LC22:
	.string	"    A * B = C\n"
.LC23:
	.string	"    arg : ./matmul [len] [Test:0,1] [loop_exe]\n"
.LC24:
	.string	"============================================\n\n"
.LC25:
	.string	"[Mem] Size of a matrix : [%d, %d]\n"
.LC28:
	.string	"[Mem] Total size of matrices : %.3fGB\n"
.LC29:
	.string	"    Test passed\n"
.LC30:
	.string	"    [ERR] Test failed!!\n"
.LC31:
	.string	"[TEST] Test skipped..\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB4115:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %r15d
	xorl	%eax, %eax
	movl	$2, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	leaq	.LC20(%rip), %rsi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	$10000, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 64
	call	__printf_chk@PLT
	leaq	.LC21(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC22(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC23(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC24(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	$1, %r15d
	jle	.L65
	movq	8(%r14), %rdi
	call	atoi@PLT
	movl	%eax, %ebx
	cmpl	$3, %r15d
	jle	.L65
	movq	24(%r14), %rdi
	call	atoi@PLT
	movl	%eax, loop_exe(%rip)
.L65:
	movl	%ebx, %r13d
	xorl	%edi, %edi
	call	srand@PLT
	imull	%ebx, %r13d
	movslq	%r13d, %r13
	leaq	0(,%r13,4), %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%r13, %rdi
	movl	$4, %esi
	movq	%rax, %rbp
	call	calloc@PLT
	movl	%ebx, %esi
	movq	%r12, %rdi
	movq	%rax, %r13
	call	_Z12h_initializePfi
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	_Z12h_initializePfi
	movl	%ebx, %ecx
	movl	%ebx, %edx
	leaq	.LC25(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cvtsi2sdl	%ebx, %xmm1
	movl	$2, %edi
	movb	$1, %al
	movsd	.LC26(%rip), %xmm0
	leaq	.LC28(%rip), %rsi
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	.LC27(%rip), %xmm0
	mulsd	.LC4(%rip), %xmm0
	call	__printf_chk@PLT
	movl	%ebx, %ecx
	movq	%r13, %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	_Z17matmul_cuda_basicPKfS0_Pfi
	movl	%ebx, %ecx
	movq	%r13, %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	_Z18matmul_cuda_sharedPKfS0_Pfi
	movl	%ebx, %ecx
	movq	%r13, %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	_Z29matmul_cuda_shared_transposedPKfS0_Pfi
	cmpl	$2, %r15d
	jle	.L67
	movq	16(%r14), %rdi
	call	atoi@PLT
	decl	%eax
	jne	.L67
	movq	%rbp, %rsi
	movl	%ebx, %ecx
	movq	%r13, %rdx
	movq	%r12, %rdi
	call	_Z6h_testPKfS0_S0_i
	leaq	.LC29(%rip), %rsi
	testb	%al, %al
	jne	.L72
	leaq	.LC30(%rip), %rsi
	jmp	.L72
.L67:
	leaq	.LC31(%rip), %rsi
.L72:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	leaq	.LC24(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rdx
	.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
.LFE4115:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4141:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4141:
	.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
	.globl	loop_exe
	.data
	.align 4
	.type	loop_exe, @object
	.size	loop_exe, 4
loop_exe:
	.long	1
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC3:
	.long	-1598689907
	.long	1051772663
	.align 8
.LC4:
	.long	-400107883
	.long	1041313291
	.align 8
.LC13:
	.long	-755914244
	.long	1062232653
	.align 8
.LC15:
	.long	0
	.long	1073741824
	.align 8
.LC26:
	.long	0
	.long	1074266112
	.align 8
.LC27:
	.long	0
	.long	1074790400
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:



#include <hip/hip_runtime.h>
#include <cstdio>
#include <cstdlib>
#include <random>
#include <sys/time.h>
#include "kernel.cuh"

#define cudaErrChk(ans) { cudaAssert((ans), __FILE__, __LINE__); }
inline void cudaAssert(hipError_t code, const char *file, int line, bool abort=true)
{
   if (code != hipSuccess) 
   {
      fprintf(stderr,"CUDA assert: %s %s %d\n", hipGetErrorString(code), file, line);
      if (abort) exit(code);
   }
}

int loop_exe = 1;

void matmul_serial (const float *A, const float *B, float *C, const int len) {
    printf("[CPU] Kernel start..\n");
    

    timeval st, ed;
    gettimeofday(&st, NULL);
    // Main body
    for (int i=0; i<len; i++) {
        for (int j=0; j<len; j++) {
            float sum = 0;
            for (int k=0; k<len; k++) {
                sum += A[i*len+k]*B[k*len+j];
            }
            C[i*len+j] = sum;
        }
    }
    // End of main body
    gettimeofday(&ed, NULL);

    float time = (ed.tv_sec - st.tv_sec) + ((ed.tv_usec-st.tv_usec)*1e-6);
    float gops = 1.0*len*len*len*1e-9;
    printf("    Total number of floating point multiplications : %.2fGops\n", gops);
    printf("    Elaped time: %.4f\n", time);
    printf("    GFLOPS : %.4f [Avg. of %d time(s)]\n", gops*loop_exe/time, loop_exe); 

}


void matmul_cuda_basic (const float *A, const float *B, float *C, const int len) {

    /***
      CUDA implementataion without any optimization methods
      **/
    const int num_threads = 16;
    const dim3 dim_threads(num_threads, num_threads);
    const dim3 dim_blocks((len+num_threads-1)/num_threads, (len+num_threads-1)/num_threads);
    printf("[GPU] Basic kernel start..\n");
    printf("    Grid size: [(%d, %d), (%d, %d)]\n", dim_blocks.y, dim_blocks.x, dim_threads.y, dim_threads.x);


    /*** Memcpy H to D ***/
    float *d_A, *d_B, *d_C;
    cudaErrChk (hipMalloc ((void **)&d_A, sizeof(float)*len*len));
    cudaErrChk (hipMalloc ((void **)&d_B, sizeof(float)*len*len));
    cudaErrChk (hipMalloc ((void **)&d_C, sizeof(float)*len*len));
    cudaErrChk (hipMemcpy (d_A, A, sizeof(float)*len*len, hipMemcpyHostToDevice));
    cudaErrChk (hipMemcpy (d_B, B, sizeof(float)*len*len, hipMemcpyHostToDevice));
    

    float gops = 1.0*len*len*len*1e-9*loop_exe;
    float msec_total = 0.0f;
    hipEvent_t start, stop;
    cudaErrChk (hipEventCreate(&start));
    cudaErrChk (hipEventCreate(&stop));
    cudaErrChk (hipEventRecord(start, NULL));
    // Main body
    for (int i=0; i<loop_exe; i++) {
        matmul_basic<<<dim_blocks, dim_threads>>>(d_A, d_B, d_C, len);
        cudaErrChk (hipDeviceSynchronize ())
        cudaErrChk( hipGetLastError() );
    }
    // End of main body
    cudaErrChk (hipEventRecord(stop, NULL));
    cudaErrChk (hipEventSynchronize(stop));
    cudaErrChk (hipEventElapsedTime(&msec_total, start, stop));


    printf("    Total number of floating point multiplications : %.2f Gops\n", gops);
    printf("    Elaped time: %.4f msec\n", msec_total);
    printf("    GFLOPS : %.4f [Avg. of %d time(s)]\n", gops/(msec_total*1e-3), loop_exe); 

    cudaErrChk (hipMemcpy(C, d_C, sizeof(float)*len*len, hipMemcpyDeviceToHost));
    cudaErrChk (hipDeviceSynchronize ())
    cudaErrChk (hipFree (d_A));
    cudaErrChk (hipFree (d_B));
    cudaErrChk (hipFree (d_C));

}



void matmul_cuda_shared (const float *A, const float *B, float *C, const int len) {

    /***
      CUDA implementataion without any optimization methods
      **/
    const int len_tile = 16;
    const dim3 dim_threads(len_tile, len_tile);
    const dim3 dim_blocks((len+len_tile-1)/len_tile, (len+len_tile-1)/len_tile);
    const int size_smem = 2*sizeof(float)*len_tile*len_tile;
    printf("[GPU] Kernel with shared memory start..\n");
    printf("    Grid size: [(%d, %d), (%d, %d)]\n", dim_blocks.y, dim_blocks.x, dim_threads.y, dim_threads.x);
    printf("    Shared mem size: %.2fKB\n", size_smem/1024.0);


    /*** Memcpy H to D ***/
    float *d_A, *d_B, *d_C;
    cudaErrChk (hipMalloc ((void **)&d_A, sizeof(float)*len*len));
    cudaErrChk (hipMalloc ((void **)&d_B, sizeof(float)*len*len));
    cudaErrChk (hipMalloc ((void **)&d_C, sizeof(float)*len*len));
    cudaErrChk (hipMemcpy (d_A, A, sizeof(float)*len*len, hipMemcpyHostToDevice));
    cudaErrChk (hipMemcpy (d_B, B, sizeof(float)*len*len, hipMemcpyHostToDevice));
    

    float gops = 1.0*len*len*len*1e-9*loop_exe;
    float msec_total = 0.0f;
    hipEvent_t start, stop;
    cudaErrChk(hipEventCreate(&start));
    cudaErrChk(hipEventCreate(&stop));
    cudaErrChk(hipEventRecord(start, NULL));
    // Main body
    for (int i=0; i<loop_exe; i++) {
        matmul_tiled<<<dim_blocks, dim_threads, size_smem>>>(d_A, d_B, d_C, len, len_tile);
        cudaErrChk (hipDeviceSynchronize ())
        cudaErrChk( hipGetLastError() );
    }
    // End of main body
    cudaErrChk(hipEventRecord(stop, NULL));
    cudaErrChk(hipEventSynchronize(stop));
    cudaErrChk(hipEventElapsedTime(&msec_total, start, stop));

    printf("    Total number of floating point multiplications : %.2f Gops\n", gops);
    printf("    Elaped time: %.4f msec\n", msec_total);
    printf("    GFLOPS : %.4f [Avg. of %d time(s)]\n", gops/(msec_total*1e-3), loop_exe); 

    cudaErrChk (hipMemcpy(C, d_C, sizeof(float)*len*len, hipMemcpyDeviceToHost));
    cudaErrChk (hipDeviceSynchronize ())
    cudaErrChk (hipFree (d_A));
    cudaErrChk (hipFree (d_B));
    cudaErrChk (hipFree (d_C));

}


void matmul_cuda_shared_transposed (const float *A, const float *B, float *C, const int len) {

    /***
      CUDA implementataion without any optimization methods
      **/
    const int len_tile = 16;
    const dim3 dim_threads(len_tile, len_tile);
    const dim3 dim_blocks((len+len_tile-1)/len_tile, (len+len_tile-1)/len_tile);
    const int size_smem = 2*sizeof(float)*len_tile*len_tile;
    printf("[GPU] Kernel with shared transposed start..\n");
    printf("    Grid size: [(%d, %d), (%d, %d)]\n", dim_blocks.y, dim_blocks.x, dim_threads.y, dim_threads.x);
    printf("    Shared mem size: %.2fKB\n", size_smem/1024.0);


    /*** Memcpy H to D ***/
    float *d_A, *d_A_T, *d_B, *d_C;
    cudaErrChk (hipMalloc ((void **)&d_A, sizeof(float)*len*len));
    cudaErrChk (hipMalloc ((void **)&d_A_T, sizeof(float)*len*len));
    cudaErrChk (hipMalloc ((void **)&d_B, sizeof(float)*len*len));
    cudaErrChk (hipMalloc ((void **)&d_C, sizeof(float)*len*len));
    cudaErrChk (hipMemcpy (d_A, A, sizeof(float)*len*len, hipMemcpyHostToDevice));
    transpose<<<dim_blocks, dim_threads>>>(d_A, d_A_T, len);
    cudaErrChk (hipMemcpy (d_B, B, sizeof(float)*len*len, hipMemcpyHostToDevice));
    

    float gops = 1.0*len*len*len*1e-9*loop_exe;
    float msec_total = 0.0f;
    hipEvent_t start, stop;
    cudaErrChk(hipEventCreate(&start));
    cudaErrChk(hipEventCreate(&stop));
    cudaErrChk(hipEventRecord(start, NULL));
    // Main body
    for (int i=0; i<loop_exe; i++) {
        matmul_tiled_transposed<<<dim_blocks, dim_threads, size_smem>>>(d_A_T, d_B, d_C, len, len_tile);
        cudaErrChk (hipDeviceSynchronize ())
        cudaErrChk( hipGetLastError() );
    }
    // End of main body
    cudaErrChk(hipEventRecord(stop, NULL));
    cudaErrChk(hipEventSynchronize(stop));
    cudaErrChk(hipEventElapsedTime(&msec_total, start, stop));

    printf("    Total number of floating point multiplications : %.2f Gops\n", gops);
    printf("    Elaped time: %.4f msec\n", msec_total);
    printf("    GFLOPS : %.4f [Avg. of %d time(s)]\n", gops/(msec_total*1e-3), loop_exe); 

    cudaErrChk (hipMemcpy(C, d_C, sizeof(float)*len*len, hipMemcpyDeviceToHost));
    cudaErrChk (hipDeviceSynchronize ())
    cudaErrChk (hipFree (d_A));
    cudaErrChk (hipFree (d_A_T));
    cudaErrChk (hipFree (d_B));
    cudaErrChk (hipFree (d_C));

}

/****************************************
  ************** Host Code **************
  ****************************************/

void h_initialize(float *mem, const int len) {
    for (int i=0; i<len; i++) {
        for (int j=0; j<len; j++) {
            mem[i*len+j] = (float)(rand()%1000);
        }
    }
}

bool h_test(const float *A, const float *B, const float *C, const int len) {
    printf("[TEST] Test start..\n");
    for (int i=0; i<len; i++) {
        for (int j=0; j<len; j++) {
            float sum = 0;
            for (int k=0; k<len; k++) {
                sum += A[i*len+k]*B[k*len+j];
            }
            if (sum != C[i*len+j]){
                printf("C[%d][%d] = %.f != %f\n", i, j, C[i*len+j], sum);
                return false;
            }
        }
    }
    return true;
}


int main(int argc, char** argv) {

    /*** Program configuration ***/
    printf("\n============================================\n");
    printf("Matrix multiplication\n");
    printf("    A * B = C\n");
    printf("    arg : ./matmul [len] [Test:0,1] [loop_exe]\n");
    printf("============================================\n\n");
    int len = (int)1e+4;
    if (argc >= 2) 
        len = atoi(argv[1]);
    if (argc >= 4) 
        loop_exe = atoi(argv[3]);
    srand(0);

    /*** Data initialize ***/
    float *A = (float *) malloc (len*len*sizeof(float));
    float *B = (float *) malloc (len*len*sizeof(float));
    float *C = (float *) calloc (len*len,sizeof(float));
    h_initialize(A, len);
    h_initialize(B, len);
    printf("[Mem] Size of a matrix : [%d, %d]\n", len, len);
    printf("[Mem] Total size of matrices : %.3fGB\n", 3.0*len*len*sizeof(float)*1e-9);


    /*** Run a matmul ***/
//    matmul_serial (A, B, C, len);
    matmul_cuda_basic (A, B, C, len);
    matmul_cuda_shared (A, B, C, len);
    matmul_cuda_shared_transposed (A, B, C, len);

    /*** Test the result ***/
    if (argc >= 3 && atoi(argv[2]) == 1) {
        if (h_test (A, B, C, len) == true) {
            printf("    Test passed\n");
        } else {
            printf("    [ERR] Test failed!!\n");
        }
    } else {
        printf("[TEST] Test skipped..\n");
    }

    /*** Finalize ***/
    free (A);
    free (B);
    free (C);


    printf("============================================\n\n");
    return 0;
}



	.text
	.file	"matmul.hip"
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z13matmul_serialPKfS0_Pfi
.LCPI0_0:
	.quad	0x3eb0c6f7a0b5ed8d              # double 9.9999999999999995E-7
.LCPI0_1:
	.quad	0x3e112e0be826d695              # double 1.0000000000000001E-9
	.text
	.globl	_Z13matmul_serialPKfS0_Pfi
	.type	_Z13matmul_serialPKfS0_Pfi,@function
_Z13matmul_serialPKfS0_Pfi:             # @_Z13matmul_serialPKfS0_Pfi
	.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	$48, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%ecx, %ebx
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r12
	movl	$.Lstr, %edi
	callq	puts@PLT
	xorl	%r13d, %r13d
	leaq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	testl	%ebx, %ebx
	jle	.LBB0_7
# %bb.1:                                # %.preheader33.lr.ph
	movl	%ebx, %eax
	leaq	(,%rax,4), %rcx
	xorl	%edx, %edx
.LBB0_2:                                # %.preheader.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_3 Depth 2
                                        #       Child Loop BB0_4 Depth 3
	movl	%r13d, %esi
	leaq	(%r12,%rsi,4), %rsi
	movq	%rdx, %rdi
	imulq	%rax, %rdi
	leaq	(%r14,%rdi,4), %rdi
	movq	%r15, %r8
	xorl	%r9d, %r9d
.LBB0_3:                                # %.preheader
                                        #   Parent Loop BB0_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB0_4 Depth 3
	xorps	%xmm0, %xmm0
	movq	%r8, %r10
	xorl	%r11d, %r11d
.LBB0_4:                                #   Parent Loop BB0_2 Depth=1
                                        #     Parent Loop BB0_3 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%rsi,%r11,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	(%r10), %xmm1
	addss	%xmm1, %xmm0
	incq	%r11
	addq	%rcx, %r10
	cmpq	%r11, %rax
	jne	.LBB0_4
# %bb.5:                                # %._crit_edge
                                        #   in Loop: Header=BB0_3 Depth=2
	movss	%xmm0, (%rdi,%r9,4)
	incq	%r9
	addq	$4, %r8
	cmpq	%rax, %r9
	jne	.LBB0_3
# %bb.6:                                # %._crit_edge37
                                        #   in Loop: Header=BB0_2 Depth=1
	incq	%rdx
	addl	%ebx, %r13d
	cmpq	%rax, %rdx
	jne	.LBB0_2
.LBB0_7:                                # %._crit_edge39
	leaq	32(%rsp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r14), %rax
	movq	8(%r14), %rcx
	subq	16(%rsp), %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	subq	24(%rsp), %rcx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rcx, %xmm1
	mulsd	.LCPI0_0(%rip), %xmm1
	addsd	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm1, %xmm0
	movss	%xmm0, 8(%rsp)                  # 4-byte Spill
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebx, %xmm0
	movapd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	mulsd	.LCPI0_1(%rip), %xmm1
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm1, %xmm0
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.1, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	8(%rsp), %xmm0                  # 4-byte Folded Reload
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	movl	loop_exe(%rip), %esi
	xorps	%xmm0, %xmm0
	cvtsi2ss	%esi, %xmm0
	mulss	12(%rsp), %xmm0                 # 4-byte Folded Reload
	divss	8(%rsp), %xmm0                  # 4-byte Folded Reload
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.3, %edi
	movb	$1, %al
	addq	$48, %rsp
	.cfi_def_cfa_offset 48
	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
	jmp	printf                          # TAILCALL
.Lfunc_end0:
	.size	_Z13matmul_serialPKfS0_Pfi, .Lfunc_end0-_Z13matmul_serialPKfS0_Pfi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z17matmul_cuda_basicPKfS0_Pfi
.LCPI1_0:
	.quad	0x3e112e0be826d695              # double 1.0000000000000001E-9
.LCPI1_1:
	.quad	0x3f50624dd2f1a9fc              # double 0.001
	.text
	.globl	_Z17matmul_cuda_basicPKfS0_Pfi
	.type	_Z17matmul_cuda_basicPKfS0_Pfi,@function
_Z17matmul_cuda_basicPKfS0_Pfi:         # @_Z17matmul_cuda_basicPKfS0_Pfi
	.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	$72, %rsp
	.cfi_def_cfa_offset 128
	.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	%ecx, %r15d
	movq	%rdx, 64(%rsp)                  # 8-byte Spill
	movq	%rsi, %r13
	movq	%rdi, %rbp
	leal	15(%r15), %eax
	leal	30(%r15), %r12d
	testl	%eax, %eax
	cmovnsl	%eax, %r12d
	sarl	$4, %r12d
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$.L.str.5, %edi
	movl	%r12d, %esi
	movl	%r12d, %edx
	movl	$16, %ecx
	movl	$16, %r8d
	xorl	%eax, %eax
	callq	printf
	movslq	%r15d, %r14
	imulq	%r14, %r14
	shlq	$2, %r14
	leaq	48(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_1
# %bb.3:                                # %_Z10cudaAssert10hipError_tPKcib.exit
	leaq	40(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_4
# %bb.5:                                # %_Z10cudaAssert10hipError_tPKcib.exit31
	leaq	32(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_6
# %bb.7:                                # %_Z10cudaAssert10hipError_tPKcib.exit33
	movq	48(%rsp), %rdi
	movq	%rbp, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_8
# %bb.9:                                # %_Z10cudaAssert10hipError_tPKcib.exit35
	movq	40(%rsp), %rdi
	movq	%r13, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_10
# %bb.11:                               # %_Z10cudaAssert10hipError_tPKcib.exit37
	movl	loop_exe(%rip), %ebp
	movl	$0, 12(%rsp)
	leaq	56(%rsp), %rdi
	callq	hipEventCreate
	testl	%eax, %eax
	jne	.LBB1_12
# %bb.13:                               # %_Z10cudaAssert10hipError_tPKcib.exit39
	leaq	24(%rsp), %rdi
	callq	hipEventCreate
	testl	%eax, %eax
	jne	.LBB1_14
# %bb.15:                               # %_Z10cudaAssert10hipError_tPKcib.exit41
	movl	%ebp, 16(%rsp)                  # 4-byte Spill
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	testl	%eax, %eax
	jne	.LBB1_22
# %bb.16:                               # %_Z10cudaAssert10hipError_tPKcib.exit43.preheader
	cmpl	$0, loop_exe(%rip)
	jle	.LBB1_24
# %bb.17:                               # %.lr.ph.preheader
	movq	%r12, %r13
	shlq	$32, %r13
	orq	%r12, %r13
	xorl	%ebp, %ebp
	movabsq	$68719476752, %r12              # imm = 0x1000000010
.LBB1_18:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_20
# %bb.19:                               #   in Loop: Header=BB1_18 Depth=1
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rsi
	movq	32(%rsp), %rdx
	movl	%r15d, %ecx
	callq	_Z27__device_stub__matmul_basicPKfS0_Pfi
.LBB1_20:                               #   in Loop: Header=BB1_18 Depth=1
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	jne	.LBB1_21
# %bb.41:                               # %_Z10cudaAssert10hipError_tPKcib.exit61
                                        #   in Loop: Header=BB1_18 Depth=1
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB1_42
# %bb.23:                               # %_Z10cudaAssert10hipError_tPKcib.exit43
                                        #   in Loop: Header=BB1_18 Depth=1
	incl	%ebp
	cmpl	loop_exe(%rip), %ebp
	jl	.LBB1_18
.LBB1_24:                               # %_Z10cudaAssert10hipError_tPKcib.exit43._crit_edge
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	testl	%eax, %eax
	jne	.LBB1_25
# %bb.26:                               # %_Z10cudaAssert10hipError_tPKcib.exit45
	movq	24(%rsp), %rdi
	callq	hipEventSynchronize
	testl	%eax, %eax
	movl	16(%rsp), %ebp                  # 4-byte Reload
	jne	.LBB1_27
# %bb.28:                               # %_Z10cudaAssert10hipError_tPKcib.exit47
	movq	56(%rsp), %rsi
	movq	24(%rsp), %rdx
	leaq	12(%rsp), %rdi
	callq	hipEventElapsedTime
	testl	%eax, %eax
	jne	.LBB1_29
# %bb.30:                               # %_Z10cudaAssert10hipError_tPKcib.exit49
	cvtsi2sd	%r15d, %xmm0
	movapd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	mulsd	.LCPI1_0(%rip), %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebp, %xmm0
	mulsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	cvtss2sd	%xmm0, %xmm0
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	movl	$.L.str.7, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	12(%rsp), %xmm0
	movl	$.L.str.8, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm1, %xmm1
	cvtss2sd	12(%rsp), %xmm1
	mulsd	.LCPI1_1(%rip), %xmm1
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	%xmm1, %xmm0
	movl	loop_exe(%rip), %esi
	movl	$.L.str.3, %edi
	movb	$1, %al
	callq	printf
	movq	32(%rsp), %rsi
	movq	64(%rsp), %rdi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_31
# %bb.32:                               # %_Z10cudaAssert10hipError_tPKcib.exit51
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	jne	.LBB1_33
# %bb.34:                               # %_Z10cudaAssert10hipError_tPKcib.exit53
	movq	48(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB1_35
# %bb.36:                               # %_Z10cudaAssert10hipError_tPKcib.exit55
	movq	40(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB1_37
# %bb.38:                               # %_Z10cudaAssert10hipError_tPKcib.exit57
	movq	32(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB1_39
# %bb.40:                               # %_Z10cudaAssert10hipError_tPKcib.exit59
	addq	$72, %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
.LBB1_42:
	.cfi_def_cfa_offset 128
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$81, %r8d
	jmp	.LBB1_2
.LBB1_21:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$80, %r8d
.LBB1_2:
	xorl	%eax, %eax
	callq	fprintf
	movl	%ebx, %edi
	callq	exit
.LBB1_1:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$64, %r8d
	jmp	.LBB1_2
.LBB1_4:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$65, %r8d
	jmp	.LBB1_2
.LBB1_6:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$66, %r8d
	jmp	.LBB1_2
.LBB1_8:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$67, %r8d
	jmp	.LBB1_2
.LBB1_10:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$68, %r8d
	jmp	.LBB1_2
.LBB1_12:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$74, %r8d
	jmp	.LBB1_2
.LBB1_14:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$75, %r8d
	jmp	.LBB1_2
.LBB1_22:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$76, %r8d
	jmp	.LBB1_2
.LBB1_25:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$84, %r8d
	jmp	.LBB1_2
.LBB1_27:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$85, %r8d
	jmp	.LBB1_2
.LBB1_29:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$86, %r8d
	jmp	.LBB1_2
.LBB1_31:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$93, %r8d
	jmp	.LBB1_2
.LBB1_33:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$94, %r8d
	jmp	.LBB1_2
.LBB1_35:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$95, %r8d
	jmp	.LBB1_2
.LBB1_37:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$96, %r8d
	jmp	.LBB1_2
.LBB1_39:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$97, %r8d
	jmp	.LBB1_2
.Lfunc_end1:
	.size	_Z17matmul_cuda_basicPKfS0_Pfi, .Lfunc_end1-_Z17matmul_cuda_basicPKfS0_Pfi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z18matmul_cuda_sharedPKfS0_Pfi
.LCPI2_0:
	.quad	0x4000000000000000              # double 2
.LCPI2_1:
	.quad	0x3e112e0be826d695              # double 1.0000000000000001E-9
.LCPI2_2:
	.quad	0x3f50624dd2f1a9fc              # double 0.001
	.text
	.globl	_Z18matmul_cuda_sharedPKfS0_Pfi
	.type	_Z18matmul_cuda_sharedPKfS0_Pfi,@function
_Z18matmul_cuda_sharedPKfS0_Pfi:        # @_Z18matmul_cuda_sharedPKfS0_Pfi
	.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	$72, %rsp
	.cfi_def_cfa_offset 128
	.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	%ecx, %r15d
	movq	%rdx, 64(%rsp)                  # 8-byte Spill
	movq	%rsi, %r13
	movq	%rdi, %rbp
	leal	15(%r15), %eax
	leal	30(%r15), %r12d
	testl	%eax, %eax
	cmovnsl	%eax, %r12d
	sarl	$4, %r12d
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	$.L.str.5, %edi
	movl	%r12d, %esi
	movl	%r12d, %edx
	movl	$16, %ecx
	movl	$16, %r8d
	xorl	%eax, %eax
	callq	printf
	movsd	.LCPI2_0(%rip), %xmm0           # xmm0 = mem[0],zero
	movl	$.L.str.10, %edi
	movb	$1, %al
	callq	printf
	movslq	%r15d, %r14
	imulq	%r14, %r14
	shlq	$2, %r14
	leaq	48(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_1
# %bb.3:                                # %_Z10cudaAssert10hipError_tPKcib.exit
	leaq	40(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_4
# %bb.5:                                # %_Z10cudaAssert10hipError_tPKcib.exit31
	leaq	32(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_6
# %bb.7:                                # %_Z10cudaAssert10hipError_tPKcib.exit33
	movq	48(%rsp), %rdi
	movq	%rbp, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_8
# %bb.9:                                # %_Z10cudaAssert10hipError_tPKcib.exit35
	movq	40(%rsp), %rdi
	movq	%r13, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_10
# %bb.11:                               # %_Z10cudaAssert10hipError_tPKcib.exit37
	movl	loop_exe(%rip), %ebp
	movl	$0, 12(%rsp)
	leaq	56(%rsp), %rdi
	callq	hipEventCreate
	testl	%eax, %eax
	jne	.LBB2_12
# %bb.13:                               # %_Z10cudaAssert10hipError_tPKcib.exit39
	leaq	24(%rsp), %rdi
	callq	hipEventCreate
	testl	%eax, %eax
	jne	.LBB2_14
# %bb.15:                               # %_Z10cudaAssert10hipError_tPKcib.exit41
	movl	%ebp, 16(%rsp)                  # 4-byte Spill
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	testl	%eax, %eax
	jne	.LBB2_22
# %bb.16:                               # %_Z10cudaAssert10hipError_tPKcib.exit43.preheader
	cmpl	$0, loop_exe(%rip)
	jle	.LBB2_24
# %bb.17:                               # %.lr.ph.preheader
	movq	%r12, %r13
	shlq	$32, %r13
	orq	%r12, %r13
	xorl	%ebp, %ebp
	movabsq	$68719476752, %r12              # imm = 0x1000000010
.LBB2_18:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$2048, %r8d                     # imm = 0x800
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_20
# %bb.19:                               #   in Loop: Header=BB2_18 Depth=1
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rsi
	movq	32(%rsp), %rdx
	movl	%r15d, %ecx
	movl	$16, %r8d
	callq	_Z27__device_stub__matmul_tiledPKfS0_Pfii
.LBB2_20:                               #   in Loop: Header=BB2_18 Depth=1
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	jne	.LBB2_21
# %bb.41:                               # %_Z10cudaAssert10hipError_tPKcib.exit61
                                        #   in Loop: Header=BB2_18 Depth=1
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB2_42
# %bb.23:                               # %_Z10cudaAssert10hipError_tPKcib.exit43
                                        #   in Loop: Header=BB2_18 Depth=1
	incl	%ebp
	cmpl	loop_exe(%rip), %ebp
	jl	.LBB2_18
.LBB2_24:                               # %_Z10cudaAssert10hipError_tPKcib.exit43._crit_edge
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	testl	%eax, %eax
	jne	.LBB2_25
# %bb.26:                               # %_Z10cudaAssert10hipError_tPKcib.exit45
	movq	24(%rsp), %rdi
	callq	hipEventSynchronize
	testl	%eax, %eax
	movl	16(%rsp), %ebp                  # 4-byte Reload
	jne	.LBB2_27
# %bb.28:                               # %_Z10cudaAssert10hipError_tPKcib.exit47
	movq	56(%rsp), %rsi
	movq	24(%rsp), %rdx
	leaq	12(%rsp), %rdi
	callq	hipEventElapsedTime
	testl	%eax, %eax
	jne	.LBB2_29
# %bb.30:                               # %_Z10cudaAssert10hipError_tPKcib.exit49
	cvtsi2sd	%r15d, %xmm0
	movapd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	mulsd	.LCPI2_1(%rip), %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebp, %xmm0
	mulsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	cvtss2sd	%xmm0, %xmm0
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	movl	$.L.str.7, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	12(%rsp), %xmm0
	movl	$.L.str.8, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm1, %xmm1
	cvtss2sd	12(%rsp), %xmm1
	mulsd	.LCPI2_2(%rip), %xmm1
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	%xmm1, %xmm0
	movl	loop_exe(%rip), %esi
	movl	$.L.str.3, %edi
	movb	$1, %al
	callq	printf
	movq	32(%rsp), %rsi
	movq	64(%rsp), %rdi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_31
# %bb.32:                               # %_Z10cudaAssert10hipError_tPKcib.exit51
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	jne	.LBB2_33
# %bb.34:                               # %_Z10cudaAssert10hipError_tPKcib.exit53
	movq	48(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB2_35
# %bb.36:                               # %_Z10cudaAssert10hipError_tPKcib.exit55
	movq	40(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB2_37
# %bb.38:                               # %_Z10cudaAssert10hipError_tPKcib.exit57
	movq	32(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB2_39
# %bb.40:                               # %_Z10cudaAssert10hipError_tPKcib.exit59
	addq	$72, %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
.LBB2_42:
	.cfi_def_cfa_offset 128
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$136, %r8d
	jmp	.LBB2_2
.LBB2_21:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$135, %r8d
.LBB2_2:
	xorl	%eax, %eax
	callq	fprintf
	movl	%ebx, %edi
	callq	exit
.LBB2_1:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$119, %r8d
	jmp	.LBB2_2
.LBB2_4:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$120, %r8d
	jmp	.LBB2_2
.LBB2_6:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$121, %r8d
	jmp	.LBB2_2
.LBB2_8:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$122, %r8d
	jmp	.LBB2_2
.LBB2_10:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$123, %r8d
	jmp	.LBB2_2
.LBB2_12:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$129, %r8d
	jmp	.LBB2_2
.LBB2_14:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$130, %r8d
	jmp	.LBB2_2
.LBB2_22:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$131, %r8d
	jmp	.LBB2_2
.LBB2_25:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$139, %r8d
	jmp	.LBB2_2
.LBB2_27:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$140, %r8d
	jmp	.LBB2_2
.LBB2_29:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$141, %r8d
	jmp	.LBB2_2
.LBB2_31:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$147, %r8d
	jmp	.LBB2_2
.LBB2_33:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$148, %r8d
	jmp	.LBB2_2
.LBB2_35:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$149, %r8d
	jmp	.LBB2_2
.LBB2_37:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$150, %r8d
	jmp	.LBB2_2
.LBB2_39:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$151, %r8d
	jmp	.LBB2_2
.Lfunc_end2:
	.size	_Z18matmul_cuda_sharedPKfS0_Pfi, .Lfunc_end2-_Z18matmul_cuda_sharedPKfS0_Pfi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z29matmul_cuda_shared_transposedPKfS0_Pfi
.LCPI3_0:
	.quad	0x4000000000000000              # double 2
.LCPI3_1:
	.quad	0x3e112e0be826d695              # double 1.0000000000000001E-9
.LCPI3_2:
	.quad	0x3f50624dd2f1a9fc              # double 0.001
	.text
	.globl	_Z29matmul_cuda_shared_transposedPKfS0_Pfi
	.type	_Z29matmul_cuda_shared_transposedPKfS0_Pfi,@function
_Z29matmul_cuda_shared_transposedPKfS0_Pfi: # @_Z29matmul_cuda_shared_transposedPKfS0_Pfi
	.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	$72, %rsp
	.cfi_def_cfa_offset 128
	.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	%ecx, %r15d
	movq	%rdx, 64(%rsp)                  # 8-byte Spill
	movq	%rsi, %rbp
	movq	%rdi, %r12
	leal	15(%r15), %eax
	leal	30(%r15), %r13d
	testl	%eax, %eax
	cmovnsl	%eax, %r13d
	sarl	$4, %r13d
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	movl	$.L.str.5, %edi
	movl	%r13d, %esi
	movl	%r13d, %edx
	movl	$16, %ecx
	movl	$16, %r8d
	xorl	%eax, %eax
	callq	printf
	movsd	.LCPI3_0(%rip), %xmm0           # xmm0 = mem[0],zero
	movl	$.L.str.10, %edi
	movb	$1, %al
	callq	printf
	movslq	%r15d, %r14
	imulq	%r14, %r14
	shlq	$2, %r14
	leaq	48(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB3_1
# %bb.3:                                # %_Z10cudaAssert10hipError_tPKcib.exit
	leaq	40(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB3_4
# %bb.5:                                # %_Z10cudaAssert10hipError_tPKcib.exit43
	leaq	32(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB3_6
# %bb.7:                                # %_Z10cudaAssert10hipError_tPKcib.exit45
	leaq	24(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB3_8
# %bb.9:                                # %_Z10cudaAssert10hipError_tPKcib.exit47
	movq	48(%rsp), %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB3_10
# %bb.11:                               # %_Z10cudaAssert10hipError_tPKcib.exit49
	movq	%r13, %r12
	shlq	$32, %r12
	orq	%r13, %r12
	movabsq	$68719476752, %r13              # imm = 0x1000000010
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r13, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_13
# %bb.12:
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rsi
	movl	%r15d, %edx
	callq	_Z24__device_stub__transposePKfPfi
.LBB3_13:
	movq	32(%rsp), %rdi
	movq	%rbp, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB3_14
# %bb.15:                               # %_Z10cudaAssert10hipError_tPKcib.exit51
	movl	loop_exe(%rip), %ebp
	movl	$0, 4(%rsp)
	leaq	56(%rsp), %rdi
	callq	hipEventCreate
	testl	%eax, %eax
	jne	.LBB3_16
# %bb.17:                               # %_Z10cudaAssert10hipError_tPKcib.exit53
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	testl	%eax, %eax
	jne	.LBB3_18
# %bb.19:                               # %_Z10cudaAssert10hipError_tPKcib.exit55
	movl	%ebp, 8(%rsp)                   # 4-byte Spill
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	testl	%eax, %eax
	jne	.LBB3_26
# %bb.20:                               # %_Z10cudaAssert10hipError_tPKcib.exit57.preheader
	cmpl	$0, loop_exe(%rip)
	jle	.LBB3_28
# %bb.21:                               # %.lr.ph.preheader
	xorl	%ebp, %ebp
.LBB3_22:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$2048, %r8d                     # imm = 0x800
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r13, %rdx
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_24
# %bb.23:                               #   in Loop: Header=BB3_22 Depth=1
	movq	40(%rsp), %rdi
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdx
	movl	%r15d, %ecx
	movl	$16, %r8d
	callq	_Z38__device_stub__matmul_tiled_transposedPKfS0_Pfii
.LBB3_24:                               #   in Loop: Header=BB3_22 Depth=1
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	jne	.LBB3_25
# %bb.47:                               # %_Z10cudaAssert10hipError_tPKcib.exit77
                                        #   in Loop: Header=BB3_22 Depth=1
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB3_48
# %bb.27:                               # %_Z10cudaAssert10hipError_tPKcib.exit57
                                        #   in Loop: Header=BB3_22 Depth=1
	incl	%ebp
	cmpl	loop_exe(%rip), %ebp
	jl	.LBB3_22
.LBB3_28:                               # %_Z10cudaAssert10hipError_tPKcib.exit57._crit_edge
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	testl	%eax, %eax
	jne	.LBB3_29
# %bb.30:                               # %_Z10cudaAssert10hipError_tPKcib.exit59
	movq	16(%rsp), %rdi
	callq	hipEventSynchronize
	testl	%eax, %eax
	movl	8(%rsp), %ebp                   # 4-byte Reload
	jne	.LBB3_31
# %bb.32:                               # %_Z10cudaAssert10hipError_tPKcib.exit61
	movq	56(%rsp), %rsi
	movq	16(%rsp), %rdx
	leaq	4(%rsp), %rdi
	callq	hipEventElapsedTime
	testl	%eax, %eax
	jne	.LBB3_33
# %bb.34:                               # %_Z10cudaAssert10hipError_tPKcib.exit63
	cvtsi2sd	%r15d, %xmm0
	movapd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	mulsd	.LCPI3_1(%rip), %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebp, %xmm0
	mulsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	cvtss2sd	%xmm0, %xmm0
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	$.L.str.7, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	4(%rsp), %xmm0
	movl	$.L.str.8, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm1, %xmm1
	cvtss2sd	4(%rsp), %xmm1
	mulsd	.LCPI3_2(%rip), %xmm1
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	%xmm1, %xmm0
	movl	loop_exe(%rip), %esi
	movl	$.L.str.3, %edi
	movb	$1, %al
	callq	printf
	movq	24(%rsp), %rsi
	movq	64(%rsp), %rdi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB3_35
# %bb.36:                               # %_Z10cudaAssert10hipError_tPKcib.exit65
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	jne	.LBB3_37
# %bb.38:                               # %_Z10cudaAssert10hipError_tPKcib.exit67
	movq	48(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB3_39
# %bb.40:                               # %_Z10cudaAssert10hipError_tPKcib.exit69
	movq	40(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB3_41
# %bb.42:                               # %_Z10cudaAssert10hipError_tPKcib.exit71
	movq	32(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB3_43
# %bb.44:                               # %_Z10cudaAssert10hipError_tPKcib.exit73
	movq	24(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB3_45
# %bb.46:                               # %_Z10cudaAssert10hipError_tPKcib.exit75
	addq	$72, %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
.LBB3_48:
	.cfi_def_cfa_offset 128
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$191, %r8d
	jmp	.LBB3_2
.LBB3_25:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$190, %r8d
.LBB3_2:
	xorl	%eax, %eax
	callq	fprintf
	movl	%ebx, %edi
	callq	exit
.LBB3_1:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$172, %r8d
	jmp	.LBB3_2
.LBB3_4:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$173, %r8d
	jmp	.LBB3_2
.LBB3_6:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$174, %r8d
	jmp	.LBB3_2
.LBB3_8:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$175, %r8d
	jmp	.LBB3_2
.LBB3_10:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$176, %r8d
	jmp	.LBB3_2
.LBB3_14:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$178, %r8d
	jmp	.LBB3_2
.LBB3_16:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$184, %r8d
	jmp	.LBB3_2
.LBB3_18:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$185, %r8d
	jmp	.LBB3_2
.LBB3_26:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$186, %r8d
	jmp	.LBB3_2
.LBB3_29:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$194, %r8d
	jmp	.LBB3_2
.LBB3_31:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$195, %r8d
	jmp	.LBB3_2
.LBB3_33:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$196, %r8d
	jmp	.LBB3_2
.LBB3_35:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$202, %r8d
	jmp	.LBB3_2
.LBB3_37:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$203, %r8d
	jmp	.LBB3_2
.LBB3_39:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$204, %r8d
	jmp	.LBB3_2
.LBB3_41:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$205, %r8d
	jmp	.LBB3_2
.LBB3_43:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$206, %r8d
	jmp	.LBB3_2
.LBB3_45:
	movl	%eax, %ebx
	movq	stderr(%rip), %r14
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.24, %esi
	movl	$.L.str.6, %ecx
	movq	%r14, %rdi
	movq	%rax, %rdx
	movl	$207, %r8d
	jmp	.LBB3_2
.Lfunc_end3:
	.size	_Z29matmul_cuda_shared_transposedPKfS0_Pfi, .Lfunc_end3-_Z29matmul_cuda_shared_transposedPKfS0_Pfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z12h_initializePfi             # -- Begin function _Z12h_initializePfi
	.type	_Z12h_initializePfi,@function
_Z12h_initializePfi:                    # @_Z12h_initializePfi
	.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
	pushq	%rax
	.cfi_def_cfa_offset 64
	.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	%rdi, (%rsp)                    # 8-byte Spill
	testl	%esi, %esi
	jle	.LBB4_5
# %bb.1:                                # %.preheader.lr.ph
	movl	%esi, %ebx
	movl	%esi, %r15d
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
.LBB4_2:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_3 Depth 2
	movl	%r12d, %eax
	movq	(%rsp), %rcx                    # 8-byte Reload
	leaq	(%rcx,%rax,4), %rbp
	xorl	%r14d, %r14d
.LBB4_3:                                #   Parent Loop BB4_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	cltq
	imulq	$274877907, %rax, %rcx          # imm = 0x10624DD3
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$38, %rcx
	addl	%edx, %ecx
	imull	$1000, %ecx, %ecx               # imm = 0x3E8
	subl	%ecx, %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%rbp,%r14,4)
	incq	%r14
	cmpq	%r14, %r15
	jne	.LBB4_3
# %bb.4:                                # %._crit_edge
                                        #   in Loop: Header=BB4_2 Depth=1
	incq	%r13
	addl	%ebx, %r12d
	cmpq	%r15, %r13
	jne	.LBB4_2
.LBB4_5:                                # %._crit_edge13
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z12h_initializePfi, .Lfunc_end4-_Z12h_initializePfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z6h_testPKfS0_S0_i             # -- Begin function _Z6h_testPKfS0_S0_i
	.type	_Z6h_testPKfS0_S0_i,@function
_Z6h_testPKfS0_S0_i:                    # @_Z6h_testPKfS0_S0_i
	.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
	pushq	%rax
	.cfi_def_cfa_offset 64
	.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	%ecx, %ebx
	movq	%rdx, %r15
	movq	%rsi, %r12
	movq	%rdi, %r13
	movl	$.Lstr.4, %edi
	callq	puts@PLT
	testl	%ebx, %ebx
	jle	.LBB5_1
# %bb.2:                                # %.preheader44.lr.ph
	movl	%ebx, %eax
	leaq	(,%rax,4), %rcx
	xorl	%edi, %edi
	xorl	%esi, %esi
	xorl	%r14d, %r14d
.LBB5_3:                                # %.preheader.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_4 Depth 2
                                        #       Child Loop BB5_5 Depth 3
	movl	%edi, %edx
	leaq	(,%rdx,4), %r8
	addq	%r13, %r8
	movq	%rsi, %rdx
	imulq	%rax, %rdx
	leaq	(%r15,%rdx,4), %r9
	movq	%r12, %r10
	xorl	%edx, %edx
.LBB5_4:                                # %.preheader
                                        #   Parent Loop BB5_3 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB5_5 Depth 3
	xorps	%xmm1, %xmm1
	movq	%r10, %r11
	xorl	%ebp, %ebp
.LBB5_5:                                #   Parent Loop BB5_3 Depth=1
                                        #     Parent Loop BB5_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%r8,%rbp,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	mulss	(%r11), %xmm0
	addss	%xmm0, %xmm1
	incq	%rbp
	addq	%rcx, %r11
	cmpq	%rbp, %rax
	jne	.LBB5_5
# %bb.6:                                # %._crit_edge
                                        #   in Loop: Header=BB5_4 Depth=2
	movss	(%r9,%rdx,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	ucomiss	%xmm0, %xmm1
	jne	.LBB5_10
	jp	.LBB5_10
# %bb.7:                                # %.critedge
                                        #   in Loop: Header=BB5_4 Depth=2
	incq	%rdx
	addq	$4, %r10
	cmpq	%rax, %rdx
	jne	.LBB5_4
# %bb.8:                                # %.thread
                                        #   in Loop: Header=BB5_3 Depth=1
	incq	%rsi
	cmpq	%rax, %rsi
	setae	%r14b
	addl	%ebx, %edi
	cmpq	%rax, %rsi
	jne	.LBB5_3
	jmp	.LBB5_9
.LBB5_10:                               # %._crit_edge55
	cvtss2sd	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm1
	movl	$.L.str.13, %edi
                                        # kill: def $esi killed $esi killed $rsi
                                        # kill: def $edx killed $edx killed $rdx
	movb	$2, %al
	callq	printf
	jmp	.LBB5_9
.LBB5_1:
	movb	$1, %r14b
.LBB5_9:                                # %._crit_edge53
	andb	$1, %r14b
	movl	%r14d, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z6h_testPKfS0_S0_i, .Lfunc_end5-_Z6h_testPKfS0_S0_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI6_0:
	.quad	0x4008000000000000              # double 3
.LCPI6_1:
	.quad	0x4010000000000000              # double 4
.LCPI6_2:
	.quad	0x3e112e0be826d695              # double 1.0000000000000001E-9
	.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
	pushq	%rax
	.cfi_def_cfa_offset 64
	.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, %rbx
	movl	%edi, %ebp
	movl	$.Lstr.5, %edi
	callq	puts@PLT
	movl	$.Lstr.6, %edi
	callq	puts@PLT
	movl	$.Lstr.7, %edi
	callq	puts@PLT
	movl	$.Lstr.8, %edi
	callq	puts@PLT
	movl	$.Lstr.13, %edi
	callq	puts@PLT
	movl	$10000, %r14d                   # imm = 0x2710
	cmpl	$2, %ebp
	jl	.LBB6_3
# %bb.1:
	movq	8(%rbx), %rdi
	callq	atoi
	movl	%eax, %r14d
	cmpl	$4, %ebp
	jb	.LBB6_3
# %bb.2:
	movq	24(%rbx), %rdi
	callq	atoi
	movl	%eax, loop_exe(%rip)
.LBB6_3:                                # %.thread
	movq	%rbx, (%rsp)                    # 8-byte Spill
	xorl	%edi, %edi
	callq	srand
	movl	%r14d, %ebx
	imull	%ebx, %ebx
	leaq	(,%rbx,4), %r12
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, %r15
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, %r12
	movl	$4, %esi
	movq	%rbx, %rdi
	callq	calloc
	movq	%rax, %r13
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_Z12h_initializePfi
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_Z12h_initializePfi
	movl	$.L.str.19, %edi
	movl	%r14d, %esi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	printf
	cvtsi2sd	%r14d, %xmm1
	movsd	.LCPI6_0(%rip), %xmm0           # xmm0 = mem[0],zero
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	.LCPI6_1(%rip), %xmm0
	mulsd	.LCPI6_2(%rip), %xmm0
	movl	$.L.str.20, %edi
	movb	$1, %al
	callq	printf
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	movl	%r14d, %ecx
	callq	_Z17matmul_cuda_basicPKfS0_Pfi
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	movl	%r14d, %ecx
	callq	_Z18matmul_cuda_sharedPKfS0_Pfi
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	movl	%r14d, %ecx
	callq	_Z29matmul_cuda_shared_transposedPKfS0_Pfi
	movl	$.Lstr.10, %ebx
	cmpl	$3, %ebp
	jl	.LBB6_6
# %bb.4:
	movq	(%rsp), %rax                    # 8-byte Reload
	movq	16(%rax), %rdi
	callq	atoi
	cmpl	$1, %eax
	jne	.LBB6_6
# %bb.5:
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	movl	%r14d, %ecx
	callq	_Z6h_testPKfS0_S0_i
	movl	$.Lstr.12, %ecx
	movl	$.Lstr.11, %ebx
	testb	%al, %al
	cmovneq	%rcx, %rbx
.LBB6_6:
	movq	%rbx, %rdi
	callq	puts@PLT
	movq	%r15, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	%r13, %rdi
	callq	free
	movl	$.Lstr.13, %edi
	callq	puts@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	main, .Lfunc_end6-main
	.cfi_endproc
                                        # -- End function
	.type	loop_exe,@object                # @loop_exe
	.data
	.globl	loop_exe
	.p2align	2, 0x0
loop_exe:
	.long	1                               # 0x1
	.size	loop_exe, 4

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"    Total number of floating point multiplications : %.2fGops\n"
	.size	.L.str.1, 63

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"    Elaped time: %.4f\n"
	.size	.L.str.2, 23

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"    GFLOPS : %.4f [Avg. of %d time(s)]\n"
	.size	.L.str.3, 40

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"    Grid size: [(%d, %d), (%d, %d)]\n"
	.size	.L.str.5, 37

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/jhson989/cuda_study/main/basic/mat_mul/matmul.hip"
	.size	.L.str.6, 112

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"    Total number of floating point multiplications : %.2f Gops\n"
	.size	.L.str.7, 64

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"    Elaped time: %.4f msec\n"
	.size	.L.str.8, 28

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"    Shared mem size: %.2fKB\n"
	.size	.L.str.10, 29

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"C[%d][%d] = %.f != %f\n"
	.size	.L.str.13, 23

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"[Mem] Size of a matrix : [%d, %d]\n"
	.size	.L.str.19, 35

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"[Mem] Total size of matrices : %.3fGB\n"
	.size	.L.str.20, 39

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"CUDA assert: %s %s %d\n"
	.size	.L.str.24, 23

	.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	"[CPU] Kernel start.."
	.size	.Lstr, 21

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"[GPU] Basic kernel start.."
	.size	.Lstr.1, 27

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"[GPU] Kernel with shared memory start.."
	.size	.Lstr.2, 40

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"[GPU] Kernel with shared transposed start.."
	.size	.Lstr.3, 44

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"[TEST] Test start.."
	.size	.Lstr.4, 20

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"\n============================================"
	.size	.Lstr.5, 46

	.type	.Lstr.6,@object                 # @str.6
.Lstr.6:
	.asciz	"Matrix multiplication"
	.size	.Lstr.6, 22

	.type	.Lstr.7,@object                 # @str.7
.Lstr.7:
	.asciz	"    A * B = C"
	.size	.Lstr.7, 14

	.type	.Lstr.8,@object                 # @str.8
.Lstr.8:
	.asciz	"    arg : ./matmul [len] [Test:0,1] [loop_exe]"
	.size	.Lstr.8, 47

	.type	.Lstr.10,@object                # @str.10
.Lstr.10:
	.asciz	"[TEST] Test skipped.."
	.size	.Lstr.10, 22

	.type	.Lstr.11,@object                # @str.11
.Lstr.11:
	.asciz	"    [ERR] Test failed!!"
	.size	.Lstr.11, 24

	.type	.Lstr.12,@object                # @str.12
.Lstr.12:
	.asciz	"    Test passed"
	.size	.Lstr.12, 16

	.type	.Lstr.13,@object                # @str.13
.Lstr.13:
	.asciz	"============================================\n"
	.size	.Lstr.13, 46

	.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_

	.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_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
