#include <stdio.h>
#include <sys/time.h>
// 计时操作
double cpuSecond(){
    struct timeval tp;
    gettimeofday(&tp,NULL);
    return ((double)tp.tv_sec + (double)tp.tv_usec*1.e-6);
}


void sumMatrixOnHost(float *h_A, float *h_B, float *h_C, const int nx, const int ny){
    for(int i = 0; i < ny; i++){
        for(int j = 0; j < nx; j++){
            int idx = j + i*nx;
            h_C[idx] = h_A[idx] + h_B[idx];
        }
    }
}


void initMatrix(float *ip, const int size){
     for(int i =0; i < size; i++) ip[i] = i;
}


__global__ void sumMatrixOnDevice2D(float *d_A, float *d_B, float *d_C, const int nx, const int ny){
    int ix = blockIdx.x*blockDim.x + threadIdx.x;
    int iy = blockIdx.y*blockDim.y + threadIdx.y;
    int idx = ix + iy*nx;
    if(idx < ny*nx) d_C[idx] = d_A[idx] + d_B[idx];
}

__global__ void sumMatrixOnDevice1D(float *d_A, float *d_B, float *d_C, const int nx, const int ny){
    unsigned int ix = threadIdx.x + blockDim.x*blockIdx.x;
    if(ix < nx){
        for(int i = 0; i < ny; i++) {
            int idx = ix + i*nx;
            d_C[idx] = d_A[idx] + d_B[idx];
        }
    }
}

void checkRef(float *h_Ref, float *d_Ref, const int nx, const int ny){
    double epsilon = 1.0e-8;
    bool match = true;
    for(int i = 0; i < ny; i++){
        for(int j = 0; j < nx; j++){
            int idx = j + i*nx;
            if(abs(d_Ref[idx]  - h_Ref[idx]) > epsilon){
                match = false;
                printf("cpu and gpu not match,\n %d, %5.3f, %5.3f\n",idx,d_Ref[idx],h_Ref[idx]);
                break;
            }
        }
    }
    if(match){
        printf("Result Match !\n");
    }
}

int main(){

    int dev = 1;
    cudaSetDevice(dev);
    // set size of data
    int nx = 1<<14;
    int ny = 1<<14;
    int nxy = nx*ny;
    int nBytes = sizeof(float)*nxy;

    float *h_A, *h_B, *h_Ref, *g_Ref;
    // malloc data
    h_A = (float *)malloc(nBytes);
    h_B = (float *)malloc(nBytes);
    h_Ref = (float *)malloc(nBytes);
    g_Ref = (float *)malloc(nBytes);

    // printf("%f %f",h_B[0],h_B[0]);

    initMatrix(h_A,nxy);
    initMatrix(h_B,nxy);

    memset(h_Ref,0,nBytes);
    memset(g_Ref,0,nBytes);

    double iStart, iEp;
    iStart = cpuSecond();
    // 
    sumMatrixOnHost(h_A,h_B,h_Ref,nx, ny);
    // printf("h_Ref[1]: h_A[1] %f + h_B[1] %f = %f\n",h_A[1],h_B[1],h_Ref[1]);
    // return 0;
    iEp = cpuSecond() - iStart;
    printf(" sumMatrixOnHost time [%.3f]sec\n",iEp);

    // define d_A d_B, d_Ref
    float *d_A, *d_B, *d_Ref;
    cudaMalloc((void **)&d_A,nBytes);
    cudaMalloc((void **)&d_B,nBytes);
    cudaMalloc((void **)&d_Ref,nBytes);

    // 
    cudaMemcpy(d_A, h_A, nBytes, cudaMemcpyHostToDevice);
    cudaMemcpy(d_B, h_B, nBytes, cudaMemcpyHostToDevice);
    
    int dimx = 128, dimy = 1;
    dim3 block(dimx,dimy);
    dim3 grid((nx + dimx - 1)/dimx, (ny + dimy - 1)/dimy);

    iStart = cpuSecond();
    sumMatrixOnDevice1D<<<grid,block>>>(d_A,d_B,d_Ref,nx,ny);
    cudaDeviceSynchronize();
    iEp = cpuSecond() - iStart;
    printf("sumMatrixOnDevice2D time <<<(%d,%d),(%d,%d)>>> [%.3f]sec\n",
    grid.x,grid.y,block.x,block.y,iEp);

    // cp data from device to host
    cudaMemcpy(g_Ref,d_Ref,nBytes,cudaMemcpyDeviceToHost);

    checkRef(g_Ref,h_Ref,nx,ny);

    free(h_A);
    free(h_B);
    free(h_Ref);
    free(g_Ref);

    cudaFree(d_A);
    cudaFree(d_B);
    cudaFree(d_Ref);

    cudaDeviceReset();

    return 0;
}
	.file	"tmpxft_0025090c_00000000-6_sumMatrixOnGPU-2D-grid-2D-block.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2034:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2034:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z9cpuSecondv
	.type	_Z9cpuSecondv, @function
_Z9cpuSecondv:
.LFB2027:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdi
	call	gettimeofday@PLT
	cvtsi2sdq	16(%rsp), %xmm0
	mulsd	.LC0(%rip), %xmm0
	cvtsi2sdq	8(%rsp), %xmm1
	addsd	%xmm1, %xmm0
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z9cpuSecondv, .-_Z9cpuSecondv
	.globl	_Z15sumMatrixOnHostPfS_S_ii
	.type	_Z15sumMatrixOnHostPfS_S_ii, @function
_Z15sumMatrixOnHostPfS_S_ii:
.LFB2028:
	.cfi_startproc
	endbr64
	movq	%rdi, %r10
	movq	%rsi, %r11
	xorl	%edi, %edi
	xorl	%r9d, %r9d
.L7:
	cmpl	%r8d, %r9d
	jge	.L6
	movslq	%edi, %rax
	xorl	%esi, %esi
	salq	$2, %rax
.L10:
	cmpl	%ecx, %esi
	jge	.L11
	movss	(%r10,%rax), %xmm0
	addss	(%r11,%rax), %xmm0
	incl	%esi
	movss	%xmm0, (%rdx,%rax)
	addq	$4, %rax
	jmp	.L10
.L11:
	incl	%r9d
	addl	%ecx, %edi
	jmp	.L7
.L6:
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z15sumMatrixOnHostPfS_S_ii, .-_Z15sumMatrixOnHostPfS_S_ii
	.globl	_Z10initMatrixPfi
	.type	_Z10initMatrixPfi, @function
_Z10initMatrixPfi:
.LFB2029:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
.L13:
	cmpl	%eax, %esi
	jle	.L15
	cvtsi2ssl	%eax, %xmm0
	movss	%xmm0, (%rdi,%rax,4)
	incq	%rax
	jmp	.L13
.L15:
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z10initMatrixPfi, .-_Z10initMatrixPfi
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"cpu and gpu not match,\n %d, %5.3f, %5.3f\n"
.LC4:
	.string	"Result Match !\n"
	.text
	.globl	_Z8checkRefPfS_ii
	.type	_Z8checkRefPfS_ii, @function
_Z8checkRefPfS_ii:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%ecx, %r15d
	movb	$1, %cl
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %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
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	pushq	%r8
	.cfi_def_cfa_offset 64
.L17:
	cmpl	%r15d, %r12d
	jge	.L22
	movslq	%ebx, %rax
	movsd	.LC2(%rip), %xmm3
	xorl	%edx, %edx
	salq	$2, %rax
.L23:
	cmpl	%ebp, %edx
	jge	.L20
	movss	(%r14,%rax), %xmm0
	movss	0(%r13,%rax), %xmm1
	addq	$4, %rax
	movaps	%xmm0, %xmm2
	subss	%xmm1, %xmm2
	andps	.LC1(%rip), %xmm2
	cvtss2sd	%xmm2, %xmm2
	comisd	%xmm3, %xmm2
	jbe	.L26
	addl	%ebx, %edx
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	movb	$2, %al
	cvtss2sd	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm1
	call	__printf_chk@PLT
	xorl	%ecx, %ecx
	jmp	.L20
.L26:
	incl	%edx
	jmp	.L23
.L20:
	incl	%r12d
	addl	%ebp, %ebx
	jmp	.L17
.L22:
	testb	%cl, %cl
	je	.L16
	popq	%rdx
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	leaq	.LC4(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 48
	movl	$2, %edi
	popq	%rbp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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_chk@PLT
.L16:
	.cfi_restore_state
	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
.LFE2030:
	.size	_Z8checkRefPfS_ii, .-_Z8checkRefPfS_ii
	.globl	_Z45__device_stub__Z19sumMatrixOnDevice2DPfS_S_iiPfS_S_ii
	.type	_Z45__device_stub__Z19sumMatrixOnDevice2DPfS_S_iiPfS_S_ii, @function
_Z45__device_stub__Z19sumMatrixOnDevice2DPfS_S_iiPfS_S_ii:
.LFB2056:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L28
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z19sumMatrixOnDevice2DPfS_S_ii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L28:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2056:
	.size	_Z45__device_stub__Z19sumMatrixOnDevice2DPfS_S_iiPfS_S_ii, .-_Z45__device_stub__Z19sumMatrixOnDevice2DPfS_S_iiPfS_S_ii
	.globl	_Z19sumMatrixOnDevice2DPfS_S_ii
	.type	_Z19sumMatrixOnDevice2DPfS_S_ii, @function
_Z19sumMatrixOnDevice2DPfS_S_ii:
.LFB2057:
	.cfi_startproc
	endbr64
	jmp	_Z45__device_stub__Z19sumMatrixOnDevice2DPfS_S_iiPfS_S_ii
	.cfi_endproc
.LFE2057:
	.size	_Z19sumMatrixOnDevice2DPfS_S_ii, .-_Z19sumMatrixOnDevice2DPfS_S_ii
	.globl	_Z45__device_stub__Z19sumMatrixOnDevice1DPfS_S_iiPfS_S_ii
	.type	_Z45__device_stub__Z19sumMatrixOnDevice1DPfS_S_iiPfS_S_ii, @function
_Z45__device_stub__Z19sumMatrixOnDevice1DPfS_S_iiPfS_S_ii:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L33
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z19sumMatrixOnDevice1DPfS_S_ii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L33:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z45__device_stub__Z19sumMatrixOnDevice1DPfS_S_iiPfS_S_ii, .-_Z45__device_stub__Z19sumMatrixOnDevice1DPfS_S_iiPfS_S_ii
	.globl	_Z19sumMatrixOnDevice1DPfS_S_ii
	.type	_Z19sumMatrixOnDevice1DPfS_S_ii, @function
_Z19sumMatrixOnDevice1DPfS_S_ii:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z45__device_stub__Z19sumMatrixOnDevice1DPfS_S_iiPfS_S_ii
	.cfi_endproc
.LFE2059:
	.size	_Z19sumMatrixOnDevice1DPfS_S_ii, .-_Z19sumMatrixOnDevice1DPfS_S_ii
	.section	.rodata.str1.1
.LC5:
	.string	" sumMatrixOnHost time [%.3f]sec\n"
.LC6:
	.string	"sumMatrixOnDevice2D time <<<(%d,%d),(%d,%d)>>> [%.3f]sec\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$1, %edi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$88, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	call	cudaSetDevice@PLT
	movl	$1073741824, %edi
	call	malloc@PLT
	movl	$1073741824, %edi
	movq	%rax, %r13
	call	malloc@PLT
	movl	$1073741824, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movl	$1073741824, %edi
	movq	%rax, %rbp
	call	malloc@PLT
	movl	$268435456, %esi
	movq	%r13, %rdi
	movl	$268435456, %ecx
	movq	%rax, %rbx
	call	_Z10initMatrixPfi
	movq	%r12, %rdi
	call	_Z10initMatrixPfi
	xorl	%eax, %eax
	movq	%rbp, %rdi
	rep stosl
	movl	$268435456, %ecx
	movq	%rbx, %rdi
	rep stosl
	call	_Z9cpuSecondv
	movl	$16384, %ecx
	movq	%rbp, %rdx
	movq	%r12, %rsi
	movl	$16384, %r8d
	movq	%r13, %rdi
	movsd	%xmm0, 8(%rsp)
	call	_Z15sumMatrixOnHostPfS_S_ii
	call	_Z9cpuSecondv
	subsd	8(%rsp), %xmm0
	leaq	.LC5(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	24(%rsp), %rdi
	movl	$1073741824, %esi
	call	cudaMalloc@PLT
	leaq	32(%rsp), %rdi
	movl	$1073741824, %esi
	call	cudaMalloc@PLT
	leaq	40(%rsp), %rdi
	movl	$1073741824, %esi
	call	cudaMalloc@PLT
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rsi
	movl	$1073741824, %edx
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movq	%r12, %rsi
	movl	$1073741824, %edx
	call	cudaMemcpy@PLT
	call	_Z9cpuSecondv
	movl	$33554433, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$7, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	movabsq	$70368744177792, %rdi
	movsd	%xmm0, 8(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L39
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$16384, %ecx
	movl	$16384, %r8d
	movq	24(%rsp), %rdi
	call	_Z45__device_stub__Z19sumMatrixOnDevice1DPfS_S_iiPfS_S_ii
.L39:
	call	cudaDeviceSynchronize@PLT
	call	_Z9cpuSecondv
	subsd	8(%rsp), %xmm0
	movl	$1, %r9d
	movl	$128, %r8d
	movl	$16384, %ecx
	movl	$128, %edx
	leaq	.LC6(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$1073741824, %edx
	call	cudaMemcpy@PLT
	movl	$16384, %ecx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	movl	$16384, %edx
	call	_Z8checkRefPfS_ii
	movq	%r13, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	call	cudaDeviceReset@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	addq	$88, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	main, .-main
	.section	.rodata.str1.1
.LC7:
	.string	"_Z19sumMatrixOnDevice1DPfS_S_ii"
.LC8:
	.string	"_Z19sumMatrixOnDevice2DPfS_S_ii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2061:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC7(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z19sumMatrixOnDevice1DPfS_S_ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC8(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z19sumMatrixOnDevice2DPfS_S_ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2061:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	-1598689907
	.long	1051772663
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	2147483647
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC2:
	.long	-500134854
	.long	1044740494
	.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 <stdio.h>
#include <sys/time.h>
// 计时操作
double cpuSecond(){
    struct timeval tp;
    gettimeofday(&tp,NULL);
    return ((double)tp.tv_sec + (double)tp.tv_usec*1.e-6);
}


void sumMatrixOnHost(float *h_A, float *h_B, float *h_C, const int nx, const int ny){
    for(int i = 0; i < ny; i++){
        for(int j = 0; j < nx; j++){
            int idx = j + i*nx;
            h_C[idx] = h_A[idx] + h_B[idx];
        }
    }
}


void initMatrix(float *ip, const int size){
     for(int i =0; i < size; i++) ip[i] = i;
}


__global__ void sumMatrixOnDevice2D(float *d_A, float *d_B, float *d_C, const int nx, const int ny){
    int ix = blockIdx.x*blockDim.x + threadIdx.x;
    int iy = blockIdx.y*blockDim.y + threadIdx.y;
    int idx = ix + iy*nx;
    if(idx < ny*nx) d_C[idx] = d_A[idx] + d_B[idx];
}

__global__ void sumMatrixOnDevice1D(float *d_A, float *d_B, float *d_C, const int nx, const int ny){
    unsigned int ix = threadIdx.x + blockDim.x*blockIdx.x;
    if(ix < nx){
        for(int i = 0; i < ny; i++) {
            int idx = ix + i*nx;
            d_C[idx] = d_A[idx] + d_B[idx];
        }
    }
}

void checkRef(float *h_Ref, float *d_Ref, const int nx, const int ny){
    double epsilon = 1.0e-8;
    bool match = true;
    for(int i = 0; i < ny; i++){
        for(int j = 0; j < nx; j++){
            int idx = j + i*nx;
            if(abs(d_Ref[idx]  - h_Ref[idx]) > epsilon){
                match = false;
                printf("cpu and gpu not match,\n %d, %5.3f, %5.3f\n",idx,d_Ref[idx],h_Ref[idx]);
                break;
            }
        }
    }
    if(match){
        printf("Result Match !\n");
    }
}

int main(){

    int dev = 1;
    hipSetDevice(dev);
    // set size of data
    int nx = 1<<14;
    int ny = 1<<14;
    int nxy = nx*ny;
    int nBytes = sizeof(float)*nxy;

    float *h_A, *h_B, *h_Ref, *g_Ref;
    // malloc data
    h_A = (float *)malloc(nBytes);
    h_B = (float *)malloc(nBytes);
    h_Ref = (float *)malloc(nBytes);
    g_Ref = (float *)malloc(nBytes);

    // printf("%f %f",h_B[0],h_B[0]);

    initMatrix(h_A,nxy);
    initMatrix(h_B,nxy);

    memset(h_Ref,0,nBytes);
    memset(g_Ref,0,nBytes);

    double iStart, iEp;
    iStart = cpuSecond();
    // 
    sumMatrixOnHost(h_A,h_B,h_Ref,nx, ny);
    // printf("h_Ref[1]: h_A[1] %f + h_B[1] %f = %f\n",h_A[1],h_B[1],h_Ref[1]);
    // return 0;
    iEp = cpuSecond() - iStart;
    printf(" sumMatrixOnHost time [%.3f]sec\n",iEp);

    // define d_A d_B, d_Ref
    float *d_A, *d_B, *d_Ref;
    hipMalloc((void **)&d_A,nBytes);
    hipMalloc((void **)&d_B,nBytes);
    hipMalloc((void **)&d_Ref,nBytes);

    // 
    hipMemcpy(d_A, h_A, nBytes, hipMemcpyHostToDevice);
    hipMemcpy(d_B, h_B, nBytes, hipMemcpyHostToDevice);
    
    int dimx = 128, dimy = 1;
    dim3 block(dimx,dimy);
    dim3 grid((nx + dimx - 1)/dimx, (ny + dimy - 1)/dimy);

    iStart = cpuSecond();
    sumMatrixOnDevice1D<<<grid,block>>>(d_A,d_B,d_Ref,nx,ny);
    hipDeviceSynchronize();
    iEp = cpuSecond() - iStart;
    printf("sumMatrixOnDevice2D time <<<(%d,%d),(%d,%d)>>> [%.3f]sec\n",
    grid.x,grid.y,block.x,block.y,iEp);

    // cp data from device to host
    hipMemcpy(g_Ref,d_Ref,nBytes,hipMemcpyDeviceToHost);

    checkRef(g_Ref,h_Ref,nx,ny);

    free(h_A);
    free(h_B);
    free(h_Ref);
    free(g_Ref);

    hipFree(d_A);
    hipFree(d_B);
    hipFree(d_Ref);

    hipDeviceReset();

    return 0;
}
	.text
	.file	"sumMatrixOnGPU-2D-grid-2D-block.hip"
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z9cpuSecondv
.LCPI0_0:
	.quad	0x3eb0c6f7a0b5ed8d              # double 9.9999999999999995E-7
	.text
	.globl	_Z9cpuSecondv
	.type	_Z9cpuSecondv,@function
_Z9cpuSecondv:                          # @_Z9cpuSecondv
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -16
	movq	%rsp, %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	cvtsi2sdq	(%rbx), %xmm1
	cvtsi2sdq	8(%rbx), %xmm0
	mulsd	.LCPI0_0(%rip), %xmm0
	addsd	%xmm1, %xmm0
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z9cpuSecondv, .Lfunc_end0-_Z9cpuSecondv
	.cfi_endproc
                                        # -- End function
	.globl	_Z15sumMatrixOnHostPfS_S_ii     # -- Begin function _Z15sumMatrixOnHostPfS_S_ii
	.type	_Z15sumMatrixOnHostPfS_S_ii,@function
_Z15sumMatrixOnHostPfS_S_ii:            # @_Z15sumMatrixOnHostPfS_S_ii
	.cfi_startproc
# %bb.0:
	testl	%r8d, %r8d
	jle	.LBB1_7
# %bb.1:                                # %.preheader.lr.ph
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%r8d, %eax
	movl	%ecx, %r8d
	xorl	%r9d, %r9d
	xorl	%r10d, %r10d
.LBB1_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_4 Depth 2
	testl	%ecx, %ecx
	jle	.LBB1_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB1_2 Depth=1
	movl	%r9d, %r14d
	leaq	(%rdx,%r14,4), %r11
	leaq	(%rsi,%r14,4), %rbx
	leaq	(%rdi,%r14,4), %r14
	xorl	%r15d, %r15d
.LBB1_4:                                #   Parent Loop BB1_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%r14,%r15,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	addss	(%rbx,%r15,4), %xmm0
	movss	%xmm0, (%r11,%r15,4)
	incq	%r15
	cmpq	%r15, %r8
	jne	.LBB1_4
.LBB1_5:                                # %._crit_edge
                                        #   in Loop: Header=BB1_2 Depth=1
	incq	%r10
	addl	%ecx, %r9d
	cmpq	%rax, %r10
	jne	.LBB1_2
# %bb.6:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB1_7:                                # %._crit_edge18
	retq
.Lfunc_end1:
	.size	_Z15sumMatrixOnHostPfS_S_ii, .Lfunc_end1-_Z15sumMatrixOnHostPfS_S_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z10initMatrixPfi               # -- Begin function _Z10initMatrixPfi
	.type	_Z10initMatrixPfi,@function
_Z10initMatrixPfi:                      # @_Z10initMatrixPfi
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB2_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%esi, %eax
	xorl	%ecx, %ecx
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ecx, %xmm0
	movss	%xmm0, (%rdi,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB2_2
.LBB2_3:                                # %._crit_edge
	retq
.Lfunc_end2:
	.size	_Z10initMatrixPfi, .Lfunc_end2-_Z10initMatrixPfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__sumMatrixOnDevice2DPfS_S_ii # -- Begin function _Z34__device_stub__sumMatrixOnDevice2DPfS_S_ii
	.type	_Z34__device_stub__sumMatrixOnDevice2DPfS_S_ii,@function
_Z34__device_stub__sumMatrixOnDevice2DPfS_S_ii: # @_Z34__device_stub__sumMatrixOnDevice2DPfS_S_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	movq	%rsp, %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z19sumMatrixOnDevice2DPfS_S_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z34__device_stub__sumMatrixOnDevice2DPfS_S_ii, .Lfunc_end3-_Z34__device_stub__sumMatrixOnDevice2DPfS_S_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__sumMatrixOnDevice1DPfS_S_ii # -- Begin function _Z34__device_stub__sumMatrixOnDevice1DPfS_S_ii
	.type	_Z34__device_stub__sumMatrixOnDevice1DPfS_S_ii,@function
_Z34__device_stub__sumMatrixOnDevice1DPfS_S_ii: # @_Z34__device_stub__sumMatrixOnDevice1DPfS_S_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	movq	%rsp, %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z19sumMatrixOnDevice1DPfS_S_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z34__device_stub__sumMatrixOnDevice1DPfS_S_ii, .Lfunc_end4-_Z34__device_stub__sumMatrixOnDevice1DPfS_S_ii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z8checkRefPfS_ii
.LCPI5_0:
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI5_1:
	.quad	0x3e45798ee2308c3a              # double 1.0E-8
	.text
	.globl	_Z8checkRefPfS_ii
	.type	_Z8checkRefPfS_ii,@function
_Z8checkRefPfS_ii:                      # @_Z8checkRefPfS_ii
	.cfi_startproc
# %bb.0:
	testl	%ecx, %ecx
	jle	.LBB5_10
# %bb.1:                                # %.preheader.lr.ph
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	movq	%rdi, %r15
	movslq	%edx, %rdi
	movl	%ecx, %r12d
	movl	%edi, %ebp
	movl	%edi, %r8d
	negl	%r8d
	shlq	$2, %rdi
	movb	$1, %al
	xorl	%r13d, %r13d
	movaps	.LCPI5_0(%rip), %xmm3           # xmm3 = [NaN,NaN,NaN,NaN]
	movsd	.LCPI5_1(%rip), %xmm4           # xmm4 = mem[0],zero
	xorl	%ebx, %ebx
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
	movl	%edx, 4(%rsp)                   # 4-byte Spill
	movq	%r8, 8(%rsp)                    # 8-byte Spill
.LBB5_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_5 Depth 2
	testl	%edx, %edx
	jle	.LBB5_7
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB5_2 Depth=1
	xorl	%esi, %esi
.LBB5_5:                                #   Parent Loop BB5_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%r14,%rsi,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	(%r15,%rsi,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	movaps	%xmm0, %xmm2
	subss	%xmm1, %xmm2
	andps	%xmm3, %xmm2
	cvtss2sd	%xmm2, %xmm2
	ucomisd	%xmm4, %xmm2
	ja	.LBB5_6
# %bb.4:                                #   in Loop: Header=BB5_5 Depth=2
	incq	%rsi
	cmpq	%rsi, %rbp
	jne	.LBB5_5
	jmp	.LBB5_7
.LBB5_6:                                #   in Loop: Header=BB5_2 Depth=1
	subl	%r13d, %esi
	cvtss2sd	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm1
	movl	$.L.str, %edi
                                        # kill: def $esi killed $esi killed $rsi
	movb	$2, %al
	callq	printf
	movsd	.LCPI5_1(%rip), %xmm4           # xmm4 = mem[0],zero
	movaps	.LCPI5_0(%rip), %xmm3           # xmm3 = [NaN,NaN,NaN,NaN]
	movq	8(%rsp), %r8                    # 8-byte Reload
	movq	16(%rsp), %rdi                  # 8-byte Reload
	movl	4(%rsp), %edx                   # 4-byte Reload
	xorl	%eax, %eax
.LBB5_7:                                # %.loopexit
                                        #   in Loop: Header=BB5_2 Depth=1
	incq	%rbx
	addq	%r8, %r13
	addq	%rdi, %r14
	addq	%rdi, %r15
	cmpq	%r12, %rbx
	jne	.LBB5_2
# %bb.8:                                # %._crit_edge
	testb	$1, %al
	leaq	24(%rsp), %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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
	jne	.LBB5_10
# %bb.9:
	retq
.LBB5_10:                               # %._crit_edge.thread
	movl	$.Lstr, %edi
	jmp	puts@PLT                        # TAILCALL
.Lfunc_end5:
	.size	_Z8checkRefPfS_ii, .Lfunc_end5-_Z8checkRefPfS_ii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI6_0:
	.quad	0x3eb0c6f7a0b5ed8d              # double 9.9999999999999995E-7
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	.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	$1, %edi
	callq	hipSetDevice
	movl	$1073741824, %edi               # imm = 0x40000000
	callq	malloc
	movq	%rax, %rbx
	movl	$1073741824, %edi               # imm = 0x40000000
	callq	malloc
	movq	%rax, %r14
	movl	$1073741824, %edi               # imm = 0x40000000
	callq	malloc
	movq	%rax, %r15
	movl	$1073741824, %edi               # imm = 0x40000000
	callq	malloc
	movq	%rax, %r12
	xorl	%eax, %eax
.LBB6_1:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%rbx,%rax,4)
	incq	%rax
	cmpq	$268435456, %rax                # imm = 0x10000000
	jne	.LBB6_1
# %bb.2:                                # %.lr.ph.i57.preheader
	xorl	%eax, %eax
.LBB6_3:                                # %.lr.ph.i57
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%r14,%rax,4)
	incq	%rax
	cmpq	$268435456, %rax                # imm = 0x10000000
	jne	.LBB6_3
# %bb.4:                                # %_Z10initMatrixPfi.exit61
	xorl	%ebp, %ebp
	movl	$1073741824, %edx               # imm = 0x40000000
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movl	$1073741824, %edx               # imm = 0x40000000
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	leaq	40(%rsp), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r13), %rax
	cvtsi2sdq	8(%r13), %xmm1
	mulsd	.LCPI6_0(%rip), %xmm1
	movl	$65536, %ecx                    # imm = 0x10000
	movq	%rbx, %rdx
	movq	%r14, %rsi
	movq	%r15, %rdi
.LBB6_5:                                # %.preheader.i
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_6 Depth 2
	xorl	%r8d, %r8d
.LBB6_6:                                #   Parent Loop BB6_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rdx,%r8,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	addss	(%rsi,%r8,4), %xmm0
	movss	%xmm0, (%rdi,%r8,4)
	incq	%r8
	cmpq	$16384, %r8                     # imm = 0x4000
	jne	.LBB6_6
# %bb.7:                                # %._crit_edge.i
                                        #   in Loop: Header=BB6_5 Depth=1
	incq	%rbp
	addq	%rcx, %rdi
	addq	%rcx, %rsi
	addq	%rcx, %rdx
	cmpq	$16384, %rbp                    # imm = 0x4000
	jne	.LBB6_5
# %bb.8:                                # %_Z15sumMatrixOnHostPfS_S_ii.exit
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	addsd	%xmm0, %xmm1
	movsd	%xmm1, 8(%rsp)                  # 8-byte Spill
	leaq	40(%rsp), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	xorps	%xmm1, %xmm1
	cvtsi2sdq	(%r13), %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2sdq	8(%r13), %xmm0
	mulsd	.LCPI6_0(%rip), %xmm0
	addsd	%xmm1, %xmm0
	subsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	leaq	32(%rsp), %r13
	movl	$1073741824, %esi               # imm = 0x40000000
	movq	%r13, %rdi
	callq	hipMalloc
	leaq	24(%rsp), %rbp
	movl	$1073741824, %esi               # imm = 0x40000000
	movq	%rbp, %rdi
	callq	hipMalloc
	leaq	16(%rsp), %rdi
	movl	$1073741824, %esi               # imm = 0x40000000
	callq	hipMalloc
	movq	(%r13), %rdi
	movl	$1073741824, %edx               # imm = 0x40000000
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%rbp), %rdi
	movl	$1073741824, %edx               # imm = 0x40000000
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	40(%rsp), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	movq	(%r13), %rbp
	movq	8(%r13), %r13
	movabsq	$70368744177792, %rdi           # imm = 0x400000000080
	movabsq	$4294967424, %rdx               # imm = 0x100000080
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_10
# %bb.9:
	movq	32(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	movl	$16384, %ecx                    # imm = 0x4000
	movl	$16384, %r8d                    # imm = 0x4000
	callq	_Z34__device_stub__sumMatrixOnDevice1DPfS_S_ii
.LBB6_10:
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r13, %xmm0
	mulsd	.LCPI6_0(%rip), %xmm0
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rbp, %xmm1
	addsd	%xmm0, %xmm1
	movsd	%xmm1, 8(%rsp)                  # 8-byte Spill
	callq	hipDeviceSynchronize
	leaq	40(%rsp), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	gettimeofday
	xorps	%xmm1, %xmm1
	cvtsi2sdq	(%r13), %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2sdq	8(%r13), %xmm0
	mulsd	.LCPI6_0(%rip), %xmm0
	addsd	%xmm1, %xmm0
	subsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	movl	$.L.str.3, %edi
	movl	$128, %esi
	movl	$16384, %edx                    # imm = 0x4000
	movl	$128, %ecx
	movl	$1, %r8d
	movb	$1, %al
	callq	printf
	movq	16(%rsp), %rsi
	movl	$1073741824, %edx               # imm = 0x40000000
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%r12, %rdi
	movq	%r15, %rsi
	movl	$16384, %edx                    # imm = 0x4000
	movl	$16384, %ecx                    # imm = 0x4000
	callq	_Z8checkRefPfS_ii
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	callq	hipDeviceReset
	xorl	%eax, %eax
	addq	$56, %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
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z19sumMatrixOnDevice2DPfS_S_ii, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z19sumMatrixOnDevice1DPfS_S_ii, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB8_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z19sumMatrixOnDevice2DPfS_S_ii,@object # @_Z19sumMatrixOnDevice2DPfS_S_ii
	.section	.rodata,"a",@progbits
	.globl	_Z19sumMatrixOnDevice2DPfS_S_ii
	.p2align	3, 0x0
_Z19sumMatrixOnDevice2DPfS_S_ii:
	.quad	_Z34__device_stub__sumMatrixOnDevice2DPfS_S_ii
	.size	_Z19sumMatrixOnDevice2DPfS_S_ii, 8

	.type	_Z19sumMatrixOnDevice1DPfS_S_ii,@object # @_Z19sumMatrixOnDevice1DPfS_S_ii
	.globl	_Z19sumMatrixOnDevice1DPfS_S_ii
	.p2align	3, 0x0
_Z19sumMatrixOnDevice1DPfS_S_ii:
	.quad	_Z34__device_stub__sumMatrixOnDevice1DPfS_S_ii
	.size	_Z19sumMatrixOnDevice1DPfS_S_ii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"cpu and gpu not match,\n %d, %5.3f, %5.3f\n"
	.size	.L.str, 42

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	" sumMatrixOnHost time [%.3f]sec\n"
	.size	.L.str.2, 33

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"sumMatrixOnDevice2D time <<<(%d,%d),(%d,%d)>>> [%.3f]sec\n"
	.size	.L.str.3, 58

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z19sumMatrixOnDevice2DPfS_S_ii"
	.size	.L__unnamed_1, 32

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z19sumMatrixOnDevice1DPfS_S_ii"
	.size	.L__unnamed_2, 32

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Result Match !"
	.size	.Lstr, 15

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z19sumMatrixOnDevice2DPfS_S_ii ; -- Begin function _Z19sumMatrixOnDevice2DPfS_S_ii
	.globl	_Z19sumMatrixOnDevice2DPfS_S_ii
	.p2align	8
	.type	_Z19sumMatrixOnDevice2DPfS_S_ii,@function
_Z19sumMatrixOnDevice2DPfS_S_ii:        ; @_Z19sumMatrixOnDevice2DPfS_S_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x2c
	s_load_b64 s[2:3], s[0:1], 0x18
	v_bfe_u32 v1, v0, 10, 10
	v_and_b32_e32 v0, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s5, s4, 16
	s_and_b32 s4, s4, 0xffff
	v_mad_u64_u32 v[2:3], null, s15, s5, v[1:2]
	s_mul_i32 s14, s14, s4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v1, v2, s2
	s_mul_i32 s2, s3, s2
	v_add3_u32 v0, s14, v0, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v0
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v1, 31, v0
	s_load_b64 s[0:1], s[0:1], 0x10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v0
	global_load_b32 v2, v[2:3], off
	global_load_b32 v3, v[4:5], off
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v2, v2, v3
	global_store_b32 v[0:1], v2, off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19sumMatrixOnDevice2DPfS_S_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 6
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z19sumMatrixOnDevice2DPfS_S_ii, .Lfunc_end0-_Z19sumMatrixOnDevice2DPfS_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 224
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z19sumMatrixOnDevice1DPfS_S_ii ; -- Begin function _Z19sumMatrixOnDevice1DPfS_S_ii
	.globl	_Z19sumMatrixOnDevice1DPfS_S_ii
	.p2align	8
	.type	_Z19sumMatrixOnDevice1DPfS_S_ii,@function
_Z19sumMatrixOnDevice1DPfS_S_ii:        ; @_Z19sumMatrixOnDevice1DPfS_S_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x2c
	s_load_b64 s[2:3], s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_cmp_gt_i32 s3, 0
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	s_cselect_b32 s4, -1, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_gt_u32_e32 vcc_lo, s2, v1
	s_and_b32 s4, vcc_lo, s4
	s_and_saveexec_b32 s5, s4
	s_cbranch_execz .LBB1_3
; %bb.1:                                ; %.lr.ph.preheader
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
.LBB1_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	v_ashrrev_i32_e32 v2, 31, v1
	s_add_i32 s3, s3, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_cmp_lg_u32 s3, 0
	v_lshlrev_b64 v[2:3], 2, v[1:2]
	v_add_nc_u32_e32 v1, s2, v1
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v4, vcc_lo, s4, v2
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v3, vcc_lo
	v_add_co_u32 v6, vcc_lo, s6, v2
	v_add_co_ci_u32_e32 v7, vcc_lo, s7, v3, vcc_lo
	global_load_b32 v0, v[4:5], off
	global_load_b32 v4, v[6:7], off
	v_add_co_u32 v2, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v0, v0, v4
	global_store_b32 v[2:3], v0, off
	s_cbranch_scc1 .LBB1_2
.LBB1_3:                                ; %.loopexit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19sumMatrixOnDevice1DPfS_S_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 8
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z19sumMatrixOnDevice1DPfS_S_ii, .Lfunc_end1-_Z19sumMatrixOnDevice1DPfS_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 208
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

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

	.end_amdgpu_metadata
