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

#define BLK 8
#define dimA (10*BLK*10*BLK)
#define dimB (10*BLK*20*BLK)
#define szA (10*BLK*10*BLK*sizeof(double))
#define szB (10*BLK*20*BLK*sizeof(double))
#define A ((const double (*)[10*BLK])a)
#define B ((const double (*)[20*BLK])b)
#define C ((double (*)[20*BLK])c)
#define bx blockIdx.x
#define by blockIdx.y
#define tx threadIdx.x
#define ty threadIdx.y

void init(int n,double *M){
    int i;
    for(i=0;i<n;i++){
        M[i]=(double)rand()/RAND_MAX;
    }
}
void check(int n,double *x,double *y){
    int i;
    double maxerr=0;
    for(i=0;i<n;i++){
        if(fabsf(x[i]-y[i])/y[i]>maxerr){
            maxerr=fabsf(x[i]-y[i])/y[i];
        }
    }
    printf("max err = %g\n",maxerr);
}
void host_mm(const double *a,const double *b,double *c){
    int i,j,k;
    for(i=0;i<10*BLK;i++){
        for(j=0;j<20*BLK;j++){
            for(k=0;k<10*BLK;k++){
                C[i][j]+=A[i][k]*B[k][j];
            }
        }
    }
}

void print(double *c){
    int i,j;
    for(i=0;i<10*BLK;i++){
        for(j=0;j<20*BLK;j++){
            printf("%.2f\t",C[i][j]);
        }
        printf("\n");
    }
}

__global__
void device_mm(const double *a,const double *b,double *c){
    int k;
    for(k=0;k<10*BLK;k++)
        C[bx*BLK+tx][by*BLK+ty]+=A[bx*BLK+tx][k]*B[k][by*BLK+ty];
}

__global__
void tiled_device_mm(const double *a,const double *b,double *c){
    __shared__ double sA[BLK][BLK];
    __shared__ double sB[BLK][BLK];
    int s,i;
    double sum=0;
    for(s=0;s<10;s++){
        sA[tx][ty]=A[bx*BLK+tx][s*BLK+ty];
        sB[tx][ty]=B[s*BLK+tx][by*BLK+ty];
        __syncthreads();
        for(i=0;i<BLK;i++){
            sum+=sA[tx][i]*sB[i][ty];
        }
        __syncthreads();
    }
    C[bx*BLK+tx][by*BLK+ty]=sum;
}



int main(){
    clock_t start,finish;
    double hosttime,devicetime;

    dim3 grid(BLK,BLK);
    dim3 block(10,20);

    double *hA,*hB,*rC,*dA,*dB,*dC,*hC;
    hA=(double*)malloc(szA);
    hB=(double*)malloc(szB);
    hC=(double*)malloc(szB);
    rC=(double*)malloc(szB);

    init(dimA,hA);
    init(dimB,hB);
    memset(hC,0,szB);

    start=clock();
    host_mm(hA,hB,hC);
    finish=clock();
    hosttime=(double)(finish-start)/CLOCKS_PER_SEC;
    printf("cpu time: %.3f\n",hosttime);
    cudaMalloc(&dA,szA);
    cudaMalloc(&dB,szB);
    cudaMalloc(&dC,szB);
    cudaMemset(dC,0,szB);    
    start=clock();
    cudaMemcpy(dA,hA,szA,cudaMemcpyHostToDevice);
    cudaMemcpy(dB,hB,szB,cudaMemcpyHostToDevice);
    device_mm<<<block,grid>>>(dA,dB,dC);
    cudaThreadSynchronize();
    cudaMemcpy(rC,dC,szB,cudaMemcpyDeviceToHost);
    finish=clock();    
    devicetime=(double)(finish-start)/CLOCKS_PER_SEC;
    printf("gpu time1: %.3f, speedup=%.3f\n",devicetime,hosttime/devicetime);
    cudaMemset(dC,0,szB);    
    start=clock();
    cudaMemcpy(dA,hA,szA,cudaMemcpyHostToDevice);
    cudaMemcpy(dB,hB,szB,cudaMemcpyHostToDevice);
    tiled_device_mm<<<block,grid>>>(dA,dB,dC);
    cudaThreadSynchronize();
    cudaMemcpy(rC,dC,szB,cudaMemcpyDeviceToHost);
    finish=clock();    
    devicetime=(double)(finish-start)/CLOCKS_PER_SEC;
    printf("gpu time2: %.3f, speedup=%.3f\n",devicetime,hosttime/devicetime);

    free(hA);
    free(hB);
    free(hC);
    free(rC);
    cudaFree(dA);
    cudaFree(dB);
    cudaFree(dC);

    return 0;
}
	.file	"tmpxft_00351316_00000000-6_matrix.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	_Z4initiPd
	.type	_Z4initiPd, @function
_Z4initiPd:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
.L3:
	cmpl	%ebx, %ebp
	jle	.L7
	call	rand@PLT
	cvtsi2sdl	%eax, %xmm0
	divsd	.LC0(%rip), %xmm0
	movsd	%xmm0, (%r12,%rbx,8)
	incq	%rbx
	jmp	.L3
.L7:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z4initiPd, .-_Z4initiPd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"max err = %g\n"
	.text
	.globl	_Z5checkiPdS_
	.type	_Z5checkiPdS_, @function
_Z5checkiPdS_:
.LFB2028:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	xorps	%xmm1, %xmm1
	movss	.LC2(%rip), %xmm3
.L9:
	cmpl	%eax, %edi
	jle	.L12
	movsd	(%rdx,%rax,8), %xmm2
	movsd	(%rsi,%rax,8), %xmm0
	incq	%rax
	subsd	%xmm2, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	andps	%xmm3, %xmm0
	cvtss2sd	%xmm0, %xmm0
	divsd	%xmm2, %xmm0
	maxsd	%xmm1, %xmm0
	movaps	%xmm0, %xmm1
	jmp	.L9
.L12:
	movaps	%xmm1, %xmm0
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z5checkiPdS_, .-_Z5checkiPdS_
	.globl	_Z7host_mmPKdS0_Pd
	.type	_Z7host_mmPKdS0_Pd, @function
_Z7host_mmPKdS0_Pd:
.LFB2029:
	.cfi_startproc
	endbr64
	leaq	102400(%rdx), %r9
.L14:
	xorl	%eax, %eax
.L18:
	leaq	(%rsi,%rax), %r8
	xorl	%ecx, %ecx
.L15:
	movsd	(%rdi,%rcx,8), %xmm0
	mulsd	(%r8), %xmm0
	incq	%rcx
	addq	$1280, %r8
	addsd	(%rdx,%rax), %xmm0
	movsd	%xmm0, (%rdx,%rax)
	cmpq	$80, %rcx
	jne	.L15
	addq	$8, %rax
	cmpq	$1280, %rax
	jne	.L18
	addq	$1280, %rdx
	addq	$640, %rdi
	cmpq	%rdx, %r9
	jne	.L14
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z7host_mmPKdS0_Pd, .-_Z7host_mmPKdS0_Pd
	.section	.rodata.str1.1
.LC4:
	.string	"%.2f\t"
.LC5:
	.string	"\n"
	.text
	.globl	_Z5printPd
	.type	_Z5printPd, @function
_Z5printPd:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC4(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	102400(%rdi), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	pushq	%rdx
	.cfi_def_cfa_offset 48
.L21:
	xorl	%ebp, %ebp
.L22:
	movsd	(%rbx,%rbp,8), %xmm0
	movq	%r13, %rsi
	movl	$2, %edi
	movb	$1, %al
	incq	%rbp
	call	__printf_chk@PLT
	cmpq	$160, %rbp
	jne	.L22
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	addq	$1280, %rbx
	call	__printf_chk@PLT
	cmpq	%r12, %rbx
	jne	.L21
	popq	%rax
	.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
.LFE2030:
	.size	_Z5printPd, .-_Z5printPd
	.globl	_Z34__device_stub__Z9device_mmPKdS0_PdPKdS0_Pd
	.type	_Z34__device_stub__Z9device_mmPKdS0_PdPKdS0_Pd, @function
_Z34__device_stub__Z9device_mmPKdS0_PdPKdS0_Pd:
.LFB2056:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%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)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L26
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z9device_mmPKdS0_Pd(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	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 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L26:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2056:
	.size	_Z34__device_stub__Z9device_mmPKdS0_PdPKdS0_Pd, .-_Z34__device_stub__Z9device_mmPKdS0_PdPKdS0_Pd
	.globl	_Z9device_mmPKdS0_Pd
	.type	_Z9device_mmPKdS0_Pd, @function
_Z9device_mmPKdS0_Pd:
.LFB2057:
	.cfi_startproc
	endbr64
	jmp	_Z34__device_stub__Z9device_mmPKdS0_PdPKdS0_Pd
	.cfi_endproc
.LFE2057:
	.size	_Z9device_mmPKdS0_Pd, .-_Z9device_mmPKdS0_Pd
	.globl	_Z41__device_stub__Z15tiled_device_mmPKdS0_PdPKdS0_Pd
	.type	_Z41__device_stub__Z15tiled_device_mmPKdS0_PdPKdS0_Pd, @function
_Z41__device_stub__Z15tiled_device_mmPKdS0_PdPKdS0_Pd:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%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)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L31
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z15tiled_device_mmPKdS0_Pd(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	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 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L31:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z41__device_stub__Z15tiled_device_mmPKdS0_PdPKdS0_Pd, .-_Z41__device_stub__Z15tiled_device_mmPKdS0_PdPKdS0_Pd
	.globl	_Z15tiled_device_mmPKdS0_Pd
	.type	_Z15tiled_device_mmPKdS0_Pd, @function
_Z15tiled_device_mmPKdS0_Pd:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z41__device_stub__Z15tiled_device_mmPKdS0_PdPKdS0_Pd
	.cfi_endproc
.LFE2059:
	.size	_Z15tiled_device_mmPKdS0_Pd, .-_Z15tiled_device_mmPKdS0_Pd
	.section	.rodata.str1.1
.LC7:
	.string	"cpu time: %.3f\n"
.LC8:
	.string	"gpu time1: %.3f, speedup=%.3f\n"
.LC9:
	.string	"gpu time2: %.3f, speedup=%.3f\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$51200, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	movabsq	$34359738376, %rax
	movl	$1, 40(%rsp)
	movl	$1, 52(%rsp)
	movq	%rax, 32(%rsp)
	movabsq	$85899345930, %rax
	movq	%rax, 44(%rsp)
	call	malloc@PLT
	movl	$102400, %edi
	movq	%rax, %rbp
	call	malloc@PLT
	movl	$102400, %edi
	movq	%rax, %rbx
	call	malloc@PLT
	movl	$102400, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rbp, %rsi
	movl	$6400, %edi
	movq	%rax, %r13
	call	_Z4initiPd
	movq	%rbx, %rsi
	movl	$12800, %edi
	call	_Z4initiPd
	xorl	%eax, %eax
	movl	$25600, %ecx
	movq	%r12, %rdi
	rep stosl
	call	clock@PLT
	movq	%r12, %rdx
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	movq	%rax, %r14
	call	_Z7host_mmPKdS0_Pd
	call	clock@PLT
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	subq	%r14, %rax
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	divsd	.LC6(%rip), %xmm0
	movq	%xmm0, %r15
	call	__printf_chk@PLT
	leaq	8(%rsp), %rdi
	movl	$51200, %esi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movl	$102400, %esi
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movl	$102400, %esi
	call	cudaMalloc@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	movl	$102400, %edx
	call	cudaMemset@PLT
	call	clock@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$51200, %edx
	movq	%rax, %r14
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$102400, %edx
	call	cudaMemcpy@PLT
	movl	40(%rsp), %ecx
	movl	52(%rsp), %esi
	xorl	%r9d, %r9d
	movq	32(%rsp), %rdx
	movq	44(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L37
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	_Z34__device_stub__Z9device_mmPKdS0_PdPKdS0_Pd
.L37:
	call	cudaThreadSynchronize@PLT
	movq	24(%rsp), %rsi
	movl	$2, %ecx
	movq	%r13, %rdi
	movl	$102400, %edx
	call	cudaMemcpy@PLT
	call	clock@PLT
	movq	%r15, %xmm1
	movl	$2, %edi
	leaq	.LC8(%rip), %rsi
	subq	%r14, %rax
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC6(%rip), %xmm0
	movb	$2, %al
	divsd	%xmm0, %xmm1
	call	__printf_chk@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	movl	$102400, %edx
	call	cudaMemset@PLT
	call	clock@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$51200, %edx
	movq	%rax, %r14
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$102400, %edx
	call	cudaMemcpy@PLT
	movl	40(%rsp), %ecx
	movl	52(%rsp), %esi
	xorl	%r9d, %r9d
	movq	32(%rsp), %rdx
	movq	44(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L38
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	_Z41__device_stub__Z15tiled_device_mmPKdS0_PdPKdS0_Pd
.L38:
	call	cudaThreadSynchronize@PLT
	movq	24(%rsp), %rsi
	movl	$2, %ecx
	movq	%r13, %rdi
	movl	$102400, %edx
	call	cudaMemcpy@PLT
	call	clock@PLT
	movq	%r15, %xmm1
	movl	$2, %edi
	leaq	.LC9(%rip), %rsi
	subq	%r14, %rax
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC6(%rip), %xmm0
	movb	$2, %al
	divsd	%xmm0, %xmm1
	call	__printf_chk@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L39
	call	__stack_chk_fail@PLT
.L39:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	main, .-main
	.section	.rodata.str1.1
.LC10:
	.string	"_Z15tiled_device_mmPKdS0_Pd"
.LC11:
	.string	"_Z9device_mmPKdS0_Pd"
	.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	.LC10(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z15tiled_device_mmPKdS0_Pd(%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	.LC11(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z9device_mmPKdS0_Pd(%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	-4194304
	.long	1105199103
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	2147483647
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC6:
	.long	0
	.long	1093567616
	.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 <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <hip/hip_runtime.h>

#define BLK 8
#define dimA (10*BLK*10*BLK)
#define dimB (10*BLK*20*BLK)
#define szA (10*BLK*10*BLK*sizeof(double))
#define szB (10*BLK*20*BLK*sizeof(double))
#define A ((const double (*)[10*BLK])a)
#define B ((const double (*)[20*BLK])b)
#define C ((double (*)[20*BLK])c)
#define bx blockIdx.x
#define by blockIdx.y
#define tx threadIdx.x
#define ty threadIdx.y

void init(int n,double *M){
    int i;
    for(i=0;i<n;i++){
        M[i]=(double)rand()/RAND_MAX;
    }
}
void check(int n,double *x,double *y){
    int i;
    double maxerr=0;
    for(i=0;i<n;i++){
        if(fabsf(x[i]-y[i])/y[i]>maxerr){
            maxerr=fabsf(x[i]-y[i])/y[i];
        }
    }
    printf("max err = %g\n",maxerr);
}
void host_mm(const double *a,const double *b,double *c){
    int i,j,k;
    for(i=0;i<10*BLK;i++){
        for(j=0;j<20*BLK;j++){
            for(k=0;k<10*BLK;k++){
                C[i][j]+=A[i][k]*B[k][j];
            }
        }
    }
}

void print(double *c){
    int i,j;
    for(i=0;i<10*BLK;i++){
        for(j=0;j<20*BLK;j++){
            printf("%.2f\t",C[i][j]);
        }
        printf("\n");
    }
}

__global__
void device_mm(const double *a,const double *b,double *c){
    int k;
    for(k=0;k<10*BLK;k++)
        C[bx*BLK+tx][by*BLK+ty]+=A[bx*BLK+tx][k]*B[k][by*BLK+ty];
}

__global__
void tiled_device_mm(const double *a,const double *b,double *c){
    __shared__ double sA[BLK][BLK];
    __shared__ double sB[BLK][BLK];
    int s,i;
    double sum=0;
    for(s=0;s<10;s++){
        sA[tx][ty]=A[bx*BLK+tx][s*BLK+ty];
        sB[tx][ty]=B[s*BLK+tx][by*BLK+ty];
        __syncthreads();
        for(i=0;i<BLK;i++){
            sum+=sA[tx][i]*sB[i][ty];
        }
        __syncthreads();
    }
    C[bx*BLK+tx][by*BLK+ty]=sum;
}



int main(){
    clock_t start,finish;
    double hosttime,devicetime;

    dim3 grid(BLK,BLK);
    dim3 block(10,20);

    double *hA,*hB,*rC,*dA,*dB,*dC,*hC;
    hA=(double*)malloc(szA);
    hB=(double*)malloc(szB);
    hC=(double*)malloc(szB);
    rC=(double*)malloc(szB);

    init(dimA,hA);
    init(dimB,hB);
    memset(hC,0,szB);

    start=clock();
    host_mm(hA,hB,hC);
    finish=clock();
    hosttime=(double)(finish-start)/CLOCKS_PER_SEC;
    printf("cpu time: %.3f\n",hosttime);
    hipMalloc(&dA,szA);
    hipMalloc(&dB,szB);
    hipMalloc(&dC,szB);
    hipMemset(dC,0,szB);    
    start=clock();
    hipMemcpy(dA,hA,szA,hipMemcpyHostToDevice);
    hipMemcpy(dB,hB,szB,hipMemcpyHostToDevice);
    device_mm<<<block,grid>>>(dA,dB,dC);
    hipDeviceSynchronize();
    hipMemcpy(rC,dC,szB,hipMemcpyDeviceToHost);
    finish=clock();    
    devicetime=(double)(finish-start)/CLOCKS_PER_SEC;
    printf("gpu time1: %.3f, speedup=%.3f\n",devicetime,hosttime/devicetime);
    hipMemset(dC,0,szB);    
    start=clock();
    hipMemcpy(dA,hA,szA,hipMemcpyHostToDevice);
    hipMemcpy(dB,hB,szB,hipMemcpyHostToDevice);
    tiled_device_mm<<<block,grid>>>(dA,dB,dC);
    hipDeviceSynchronize();
    hipMemcpy(rC,dC,szB,hipMemcpyDeviceToHost);
    finish=clock();    
    devicetime=(double)(finish-start)/CLOCKS_PER_SEC;
    printf("gpu time2: %.3f, speedup=%.3f\n",devicetime,hosttime/devicetime);

    free(hA);
    free(hB);
    free(hC);
    free(rC);
    hipFree(dA);
    hipFree(dB);
    hipFree(dC);

    return 0;
}
	.text
	.file	"matrix.hip"
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z4initiPd
.LCPI0_0:
	.quad	0x41dfffffffc00000              # double 2147483647
	.text
	.globl	_Z4initiPd
	.type	_Z4initiPd,@function
_Z4initiPd:                             # @_Z4initiPd
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jle	.LBB0_4
# %bb.1:                                # %.lr.ph.preheader
	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
	movq	%rsi, %rbx
	movl	%edi, %r14d
	xorl	%r15d, %r15d
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI0_0(%rip), %xmm0
	movsd	%xmm0, (%rbx,%r15,8)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB0_2
# %bb.3:
	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
.LBB0_4:                                # %._crit_edge
	retq
.Lfunc_end0:
	.size	_Z4initiPd, .Lfunc_end0-_Z4initiPd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z5checkiPdS_
.LCPI1_0:
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.text
	.globl	_Z5checkiPdS_
	.type	_Z5checkiPdS_,@function
_Z5checkiPdS_:                          # @_Z5checkiPdS_
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jle	.LBB1_1
# %bb.3:                                # %.lr.ph.preheader
	movl	%edi, %eax
	xorpd	%xmm2, %xmm2
	xorl	%ecx, %ecx
	movaps	.LCPI1_0(%rip), %xmm1           # xmm1 = [NaN,NaN,NaN,NaN]
.LBB1_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%rsi,%rcx,8), %xmm0            # xmm0 = mem[0],zero
	movsd	(%rdx,%rcx,8), %xmm3            # xmm3 = mem[0],zero
	subsd	%xmm3, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	andps	%xmm1, %xmm0
	cvtss2sd	%xmm0, %xmm0
	divsd	%xmm3, %xmm0
	maxsd	%xmm2, %xmm0
	incq	%rcx
	movapd	%xmm0, %xmm2
	cmpq	%rcx, %rax
	jne	.LBB1_4
	jmp	.LBB1_2
.LBB1_1:
	xorpd	%xmm0, %xmm0
.LBB1_2:                                # %._crit_edge
	movl	$.L.str, %edi
	movb	$1, %al
	jmp	printf                          # TAILCALL
.Lfunc_end1:
	.size	_Z5checkiPdS_, .Lfunc_end1-_Z5checkiPdS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z7host_mmPKdS0_Pd              # -- Begin function _Z7host_mmPKdS0_Pd
	.type	_Z7host_mmPKdS0_Pd,@function
_Z7host_mmPKdS0_Pd:                     # @_Z7host_mmPKdS0_Pd
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	xorl	%eax, %eax
.LBB2_1:                                # %.preheader16
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_2 Depth 2
                                        #       Child Loop BB2_3 Depth 3
	leaq	(%rax,%rax,4), %rcx
	shlq	$8, %rcx
	addq	%rdx, %rcx
	movq	%rsi, %r8
	xorl	%r9d, %r9d
.LBB2_2:                                # %.preheader
                                        #   Parent Loop BB2_1 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB2_3 Depth 3
	leaq	(%rcx,%r9,8), %r10
	movsd	(%r10), %xmm0                   # xmm0 = mem[0],zero
	movq	%r8, %r11
	xorl	%ebx, %ebx
.LBB2_3:                                #   Parent Loop BB2_1 Depth=1
                                        #     Parent Loop BB2_2 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	(%rdi,%rbx,8), %xmm1            # xmm1 = mem[0],zero
	mulsd	(%r11), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, (%r10)
	incq	%rbx
	addq	$1280, %r11                     # imm = 0x500
	cmpq	$80, %rbx
	jne	.LBB2_3
# %bb.4:                                #   in Loop: Header=BB2_2 Depth=2
	incq	%r9
	addq	$8, %r8
	cmpq	$160, %r9
	jne	.LBB2_2
# %bb.5:                                #   in Loop: Header=BB2_1 Depth=1
	incq	%rax
	addq	$640, %rdi                      # imm = 0x280
	cmpq	$80, %rax
	jne	.LBB2_1
# %bb.6:
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z7host_mmPKdS0_Pd, .Lfunc_end2-_Z7host_mmPKdS0_Pd
	.cfi_endproc
                                        # -- End function
	.globl	_Z5printPd                      # -- Begin function _Z5printPd
	.type	_Z5printPd,@function
_Z5printPd:                             # @_Z5printPd
	.cfi_startproc
# %bb.0:
	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
	movq	%rdi, %rbx
	xorl	%r14d, %r14d
.LBB3_1:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_2 Depth 2
	xorl	%r15d, %r15d
.LBB3_2:                                #   Parent Loop BB3_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%rbx,%r15,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str.1, %edi
	movb	$1, %al
	callq	printf
	incq	%r15
	cmpq	$160, %r15
	jne	.LBB3_2
# %bb.3:                                #   in Loop: Header=BB3_1 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r14
	addq	$1280, %rbx                     # imm = 0x500
	cmpq	$80, %r14
	jne	.LBB3_1
# %bb.4:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z5printPd, .Lfunc_end3-_Z5printPd
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__device_mmPKdS0_Pd # -- Begin function _Z24__device_stub__device_mmPKdS0_Pd
	.type	_Z24__device_stub__device_mmPKdS0_Pd,@function
_Z24__device_stub__device_mmPKdS0_Pd:   # @_Z24__device_stub__device_mmPKdS0_Pd
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%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	$_Z9device_mmPKdS0_Pd, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z24__device_stub__device_mmPKdS0_Pd, .Lfunc_end4-_Z24__device_stub__device_mmPKdS0_Pd
	.cfi_endproc
                                        # -- End function
	.globl	_Z30__device_stub__tiled_device_mmPKdS0_Pd # -- Begin function _Z30__device_stub__tiled_device_mmPKdS0_Pd
	.type	_Z30__device_stub__tiled_device_mmPKdS0_Pd,@function
_Z30__device_stub__tiled_device_mmPKdS0_Pd: # @_Z30__device_stub__tiled_device_mmPKdS0_Pd
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%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	$_Z15tiled_device_mmPKdS0_Pd, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z30__device_stub__tiled_device_mmPKdS0_Pd, .Lfunc_end5-_Z30__device_stub__tiled_device_mmPKdS0_Pd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI6_0:
	.quad	0x41dfffffffc00000              # double 2147483647
.LCPI6_1:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.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	$51200, %edi                    # imm = 0xC800
	callq	malloc
	movq	%rax, %rbx
	movl	$102400, %edi                   # imm = 0x19000
	callq	malloc
	movq	%rax, %r14
	movl	$102400, %edi                   # imm = 0x19000
	callq	malloc
	movq	%rax, %r15
	movl	$102400, %edi                   # imm = 0x19000
	callq	malloc
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	xorl	%r12d, %r12d
.LBB6_1:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	movsd	.LCPI6_0(%rip), %xmm1           # xmm1 = mem[0],zero
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	%xmm1, %xmm0
	movsd	%xmm0, (%rbx,%r12,8)
	incq	%r12
	cmpq	$6400, %r12                     # imm = 0x1900
	jne	.LBB6_1
# %bb.2:                                # %.lr.ph.i43.preheader
	xorl	%r12d, %r12d
.LBB6_3:                                # %.lr.ph.i43
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI6_0(%rip), %xmm0
	movsd	%xmm0, (%r14,%r12,8)
	incq	%r12
	cmpq	$12800, %r12                    # imm = 0x3200
	jne	.LBB6_3
# %bb.4:                                # %_Z4initiPd.exit47
	xorl	%r12d, %r12d
	movl	$102400, %edx                   # imm = 0x19000
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	callq	clock
	movq	%rax, %r13
	movq	%rbx, %rax
.LBB6_5:                                # %.preheader16.i
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_6 Depth 2
                                        #       Child Loop BB6_7 Depth 3
	leaq	(%r12,%r12,4), %rcx
	shlq	$8, %rcx
	addq	%r15, %rcx
	movq	%r14, %rdx
	xorl	%esi, %esi
.LBB6_6:                                # %.preheader.i
                                        #   Parent Loop BB6_5 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB6_7 Depth 3
	leaq	(%rcx,%rsi,8), %rdi
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movq	%rdx, %r8
	xorl	%r9d, %r9d
.LBB6_7:                                #   Parent Loop BB6_5 Depth=1
                                        #     Parent Loop BB6_6 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	(%rax,%r9,8), %xmm1             # xmm1 = mem[0],zero
	mulsd	(%r8), %xmm1
	addsd	%xmm1, %xmm0
	incq	%r9
	addq	$1280, %r8                      # imm = 0x500
	cmpq	$80, %r9
	jne	.LBB6_7
# %bb.8:                                #   in Loop: Header=BB6_6 Depth=2
	movsd	%xmm0, (%rdi)
	incq	%rsi
	addq	$8, %rdx
	cmpq	$160, %rsi
	jne	.LBB6_6
# %bb.9:                                #   in Loop: Header=BB6_5 Depth=1
	incq	%r12
	addq	$640, %rax                      # imm = 0x280
	cmpq	$80, %r12
	jne	.LBB6_5
# %bb.10:                               # %_Z7host_mmPKdS0_Pd.exit
	callq	clock
	subq	%r13, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI6_1(%rip), %xmm0
	movl	$.L.str.3, %edi
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	movb	$1, %al
	callq	printf
	leaq	16(%rsp), %r12
	movl	$51200, %esi                    # imm = 0xC800
	movq	%r12, %rdi
	callq	hipMalloc
	leaq	8(%rsp), %rbp
	movl	$102400, %esi                   # imm = 0x19000
	movq	%rbp, %rdi
	callq	hipMalloc
	movq	%rsp, %r13
	movl	$102400, %esi                   # imm = 0x19000
	movq	%r13, %rdi
	callq	hipMalloc
	movq	(%r13), %rdi
	movl	$102400, %edx                   # imm = 0x19000
	xorl	%esi, %esi
	callq	hipMemset
	callq	clock
	movq	%rax, %r13
	movq	(%r12), %rdi
	movl	$51200, %edx                    # imm = 0xC800
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%rbp), %rdi
	movabsq	$34359738376, %rbp              # imm = 0x800000008
	movl	$102400, %edx                   # imm = 0x19000
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movabsq	$85899345930, %rdi              # imm = 0x140000000A
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_12
# %bb.11:
	movq	16(%rsp), %rdi
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	callq	_Z24__device_stub__device_mmPKdS0_Pd
.LBB6_12:
	callq	hipDeviceSynchronize
	movq	(%rsp), %rsi
	movl	$102400, %edx                   # imm = 0x19000
	movq	32(%rsp), %r12                  # 8-byte Reload
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	callq	clock
	subq	%r13, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI6_1(%rip), %xmm0
	movsd	24(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	divsd	%xmm0, %xmm1
	movl	$.L.str.4, %edi
	movb	$2, %al
	callq	printf
	movq	(%rsp), %rdi
	movl	$102400, %edx                   # imm = 0x19000
	xorl	%esi, %esi
	callq	hipMemset
	callq	clock
	movq	%rax, %r13
	movq	16(%rsp), %rdi
	movl	$51200, %edx                    # imm = 0xC800
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	movl	$102400, %edx                   # imm = 0x19000
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movabsq	$85899345930, %rdi              # imm = 0x140000000A
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_14
# %bb.13:
	movq	16(%rsp), %rdi
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	callq	_Z30__device_stub__tiled_device_mmPKdS0_Pd
.LBB6_14:
	callq	hipDeviceSynchronize
	movq	(%rsp), %rsi
	movl	$102400, %edx                   # imm = 0x19000
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	callq	clock
	subq	%r13, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI6_1(%rip), %xmm0
	movsd	24(%rsp), %xmm1                 # 8-byte Reload
                                        # xmm1 = mem[0],zero
	divsd	%xmm0, %xmm1
	movl	$.L.str.5, %edi
	movb	$2, %al
	callq	printf
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$40, %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	$_Z9device_mmPKdS0_Pd, %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	$_Z15tiled_device_mmPKdS0_Pd, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB8_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"max err = %g\n"
	.size	.L.str, 14

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"%.2f\t"
	.size	.L.str.1, 6

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

	.type	_Z15tiled_device_mmPKdS0_Pd,@object # @_Z15tiled_device_mmPKdS0_Pd
	.globl	_Z15tiled_device_mmPKdS0_Pd
	.p2align	3, 0x0
_Z15tiled_device_mmPKdS0_Pd:
	.quad	_Z30__device_stub__tiled_device_mmPKdS0_Pd
	.size	_Z15tiled_device_mmPKdS0_Pd, 8

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

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"gpu time1: %.3f, speedup=%.3f\n"
	.size	.L.str.4, 31

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"gpu time2: %.3f, speedup=%.3f\n"
	.size	.L.str.5, 31

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9device_mmPKdS0_Pd"
	.size	.L__unnamed_1, 21

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z15tiled_device_mmPKdS0_Pd"
	.size	.L__unnamed_2, 28

	.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

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9device_mmPKdS0_Pd    ; -- Begin function _Z9device_mmPKdS0_Pd
	.globl	_Z9device_mmPKdS0_Pd
	.p2align	8
	.type	_Z9device_mmPKdS0_Pd,@function
_Z9device_mmPKdS0_Pd:                   ; @_Z9device_mmPKdS0_Pd
; %bb.0:
	s_load_b64 s[2:3], s[0:1], 0x10
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v0, v0, 10, 10
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_lshl_add_u32 v8, s14, 3, v1
	v_mov_b32_e32 v1, 0
	v_lshl_add_u32 v0, s15, 3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[6:7], 3, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[2:3], null, 0x500, v8, s[2:3]
	s_load_b128 s[0:3], s[0:1], 0x0
	v_add_co_u32 v0, vcc_lo, v2, v6
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, v3, v7, vcc_lo
	global_load_b64 v[2:3], v[0:1], off
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[4:5], null, 0x280, v8, s[0:1]
	v_add_co_u32 v6, vcc_lo, s2, v6
	v_add_co_ci_u32_e32 v7, vcc_lo, s3, v7, vcc_lo
	s_mov_b64 s[0:1], 0
.LBB0_1:                                ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_3) | instid1(SALU_CYCLE_1)
	v_add_co_u32 v8, vcc_lo, v4, s0
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v9, vcc_lo, s1, v5, vcc_lo
	s_add_u32 s0, s0, 8
	s_addc_u32 s1, s1, 0
	global_load_b64 v[10:11], v[6:7], off
	global_load_b64 v[8:9], v[8:9], off
	v_add_co_u32 v6, vcc_lo, 0x500, v6
	v_add_co_ci_u32_e32 v7, vcc_lo, 0, v7, vcc_lo
	s_cmpk_lg_i32 s0, 0x280
	s_waitcnt vmcnt(0)
	v_fma_f64 v[2:3], v[8:9], v[10:11], v[2:3]
	global_store_b64 v[0:1], v[2:3], off
	s_cbranch_scc1 .LBB0_1
; %bb.2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9device_mmPKdS0_Pd
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 24
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 12
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z9device_mmPKdS0_Pd, .Lfunc_end0-_Z9device_mmPKdS0_Pd
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 240
; NumSgprs: 18
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 12
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z15tiled_device_mmPKdS0_Pd ; -- Begin function _Z15tiled_device_mmPKdS0_Pd
	.globl	_Z15tiled_device_mmPKdS0_Pd
	.p2align	8
	.type	_Z15tiled_device_mmPKdS0_Pd,@function
_Z15tiled_device_mmPKdS0_Pd:            ; @_Z15tiled_device_mmPKdS0_Pd
; %bb.0:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_bfe_u32 v9, v0, 10, 10
	s_load_b64 s[0:1], s[0:1], 0x10
	v_dual_mov_b32 v3, 0 :: v_dual_and_b32 v10, 0x3ff, v0
	s_mov_b32 s2, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_lshlrev_b32_e32 v0, 3, v9
	v_lshl_add_u32 v2, s15, 3, v9
	v_lshl_add_u32 v8, s14, 3, v10
	v_lshlrev_b32_e32 v11, 6, v10
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_nc_u32_e32 v13, 0x200, v0
	v_lshlrev_b64 v[4:5], 3, v[2:3]
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_add_nc_u32_e32 v12, v11, v0
	v_mov_b32_e32 v0, 0
	v_dual_mov_b32 v1, 0 :: v_dual_add_nc_u32 v14, v13, v11
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[6:7], null, 0x280, v8, s[4:5]
.LBB1_1:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_2 Depth 2
	s_lshl_b32 s3, s2, 3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v2, s3, v9
	v_add_nc_u32_e32 v19, s3, v10
	s_mov_b32 s3, 0
	v_lshlrev_b64 v[15:16], 3, v[2:3]
	v_mov_b32_e32 v2, v13
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mad_u64_u32 v[17:18], null, 0x500, v19, s[6:7]
	v_add_co_u32 v15, vcc_lo, v6, v15
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v16, vcc_lo, v7, v16, vcc_lo
	v_add_co_u32 v17, vcc_lo, v17, v4
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v18, vcc_lo, v18, v5, vcc_lo
	global_load_b64 v[15:16], v[15:16], off
	global_load_b64 v[17:18], v[17:18], off
	s_waitcnt vmcnt(1)
	ds_store_b64 v12, v[15:16]
	s_waitcnt vmcnt(0)
	ds_store_b64 v14, v[17:18]
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB1_2:                                ;   Parent Loop BB1_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	v_add_nc_u32_e32 v17, s3, v11
	s_add_i32 s3, s3, 8
	ds_load_b64 v[15:16], v2
	ds_load_b64 v[17:18], v17
	v_add_nc_u32_e32 v2, 64, v2
	s_cmp_lg_u32 s3, 64
	s_waitcnt lgkmcnt(0)
	v_fma_f64 v[0:1], v[17:18], v[15:16], v[0:1]
	s_cbranch_scc1 .LBB1_2
; %bb.3:                                ;   in Loop: Header=BB1_1 Depth=1
	s_add_i32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s2, 10
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB1_1
; %bb.4:
	v_mad_u64_u32 v[2:3], null, 0x500, v8, s[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, v2, v4
	v_add_co_ci_u32_e32 v3, vcc_lo, v3, v5, vcc_lo
	global_store_b64 v[2:3], v[0:1], off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15tiled_device_mmPKdS0_Pd
		.amdhsa_group_segment_fixed_size 1024
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 24
		.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 20
		.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	_Z15tiled_device_mmPKdS0_Pd, .Lfunc_end1-_Z15tiled_device_mmPKdS0_Pd
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 384
; NumSgprs: 18
; NumVgprs: 20
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 1024 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 20
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 24
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9device_mmPKdS0_Pd
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9device_mmPKdS0_Pd.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     12
    .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
    .group_segment_fixed_size: 1024
    .kernarg_segment_align: 8
    .kernarg_segment_size: 24
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15tiled_device_mmPKdS0_Pd
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15tiled_device_mmPKdS0_Pd.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     20
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
