#include <cuda_runtime.h>
#include <assert.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
#include <device_launch_parameters.h>


#define CUDA_CALL(x) { const cudaError_t a = (x); if(a != cudaSuccess) { printf("\nCuda Error: %s (err_num=%d) at line:%d\n", cudaGetErrorString(a), a, __LINE__); cudaDeviceReset(); assert(0);}}

#define MATRIX_SIZE 1024

int BLOCK_WIDTH,BLOCK_HEIGHT;
void init_mat(float mat[MATRIX_SIZE][MATRIX_SIZE]);
static __global__ void cuda_1(float C[MATRIX_SIZE][MATRIX_SIZE],float A[MATRIX_SIZE][MATRIX_SIZE] , float B[MATRIX_SIZE][MATRIX_SIZE]);

extern "C" void cuda_version_1(float C[MATRIX_SIZE][MATRIX_SIZE],float A[MATRIX_SIZE][MATRIX_SIZE] , float B[MATRIX_SIZE][MATRIX_SIZE])
{

	void *A_dev, *B_dev, *C_dev;

	cudaEvent_t start,stop;
	

	CUDA_CALL(cudaMalloc((void**)&A_dev, sizeof(float) * MATRIX_SIZE * MATRIX_SIZE));
	CUDA_CALL(cudaMalloc((void**)&B_dev, sizeof(float) * MATRIX_SIZE * MATRIX_SIZE));
	CUDA_CALL(cudaMalloc((void**)&C_dev, sizeof(float) * MATRIX_SIZE * MATRIX_SIZE));

	// take data from host to device.
	CUDA_CALL(cudaMemcpy(A_dev, A, sizeof(float) * MATRIX_SIZE * MATRIX_SIZE,cudaMemcpyHostToDevice));

	CUDA_CALL(cudaMemcpy(A_dev, B, sizeof(float) * MATRIX_SIZE * MATRIX_SIZE,cudaMemcpyHostToDevice));

	dim3 block(BLOCK_WIDTH, BLOCK_HEIGHT);
	dim3 grid(MATRIX_SIZE/BLOCK_WIDTH, MATRIX_SIZE/BLOCK_HEIGHT);
	float dev_time;



	printf("[CUDA 1] Start Launching Kernel.\n");
	//CHECK_TIME_START_GPU();

	cudaEventCreate(&start);
	cudaEventCreate(&stop);
	cudaEventRecord(start, 0);

	cuda_1<<<grid, block>>>((float(*)[MATRIX_SIZE])C_dev, (float(*)[MATRIX_SIZE])A_dev, (float(*)[MATRIX_SIZE])B_dev);

	//CHECK_TIME_END_GPU(dev_time);
	cudaEventRecord(stop, 0);
	cudaEventSynchronize(stop);

	cudaEventElapsedTime(&dev_time, start, stop);
	
	cudaEventDestroy(start);
	cudaEventDestroy(stop);
	printf("[CUDA 1] Processing Elapsed Time : %.3f (sec).\n",dev_time/1000);




	//take result from device to host.
	CUDA_CALL(cudaMemcpy( C, C_dev, sizeof(float) * MATRIX_SIZE* MATRIX_SIZE, cudaMemcpyDeviceToHost));
	CUDA_CALL( cudaDeviceSynchronize() );


}
static __global__ void cuda_1(float C[MATRIX_SIZE][MATRIX_SIZE],float A[MATRIX_SIZE][MATRIX_SIZE] , float B[MATRIX_SIZE][MATRIX_SIZE])
{
	int col = blockIdx.x * blockDim.x + threadIdx.x;
	int row = blockIdx.y * blockDim.y + threadIdx.y;
	float result = 0.0f;

	for(int i = 0 ; i < MATRIX_SIZE; ++i)
	{
		result += A[row][i] * B[i][col];
	}
	C[row][col] = result;


}

void init_mat(float mat[MATRIX_SIZE][MATRIX_SIZE])
{
	for (int i = 0 ; i < MATRIX_SIZE; ++i)
		for(int j = 0 ; j < MATRIX_SIZE; ++j)
			mat[i][j] = ( (float) rand()*2.f/RAND_MAX ) - 1.f;

}

float A[MATRIX_SIZE][MATRIX_SIZE],B[MATRIX_SIZE][MATRIX_SIZE],C_cuda_1[MATRIX_SIZE][MATRIX_SIZE];

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

	printf("input BLOCK WIDTH , BLOCK HEIGHT : ");
	scanf("%d %d",&BLOCK_WIDTH,&BLOCK_HEIGHT);
	init_mat(A);
	init_mat(B);

	cuda_version_1(C_cuda_1, A, B);


}

	.file	"tmpxft_00298972_00000000-6_cuda.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2032:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2032:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_ZL37__device_stub__Z6cuda_1PA1024_fS0_S0_PA1024_fS0_S0_, @function
_ZL37__device_stub__Z6cuda_1PA1024_fS0_S0_PA1024_fS0_S0_:
.LFB2054:
	.cfi_startproc
	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	.L2
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_ZL6cuda_1PA1024_fS0_S0_(%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
.L2:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2054:
	.size	_ZL37__device_stub__Z6cuda_1PA1024_fS0_S0_PA1024_fS0_S0_, .-_ZL37__device_stub__Z6cuda_1PA1024_fS0_S0_PA1024_fS0_S0_
	.type	_ZL6cuda_1PA1024_fS0_S0_, @function
_ZL6cuda_1PA1024_fS0_S0_:
.LFB2055:
	.cfi_startproc
	endbr64
	jmp	_ZL37__device_stub__Z6cuda_1PA1024_fS0_S0_PA1024_fS0_S0_
	.cfi_endproc
.LFE2055:
	.size	_ZL6cuda_1PA1024_fS0_S0_, .-_ZL6cuda_1PA1024_fS0_S0_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"\nCuda Error: %s (err_num=%d) at line:%d\n"
.LC1:
	.string	"[CUDA 1] Start Launching Kernel.\n"
.LC3:
	.string	"[CUDA 1] Processing Elapsed Time : %.3f (sec).\n"
	.text
	.globl	cuda_version_1
	.type	cuda_version_1, @function
cuda_version_1:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rsi, %r13
	movl	$4194304, %esi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	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
	leaq	8(%rsp), %rdi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L9
	movl	%eax, %edi
	movl	%eax, %ebx
	call	cudaGetErrorString@PLT
	movl	$26, %r8d
	movl	%ebx, %ecx
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaDeviceReset@PLT
.L9:
	leaq	16(%rsp), %rdi
	movl	$4194304, %esi
	call	cudaMalloc@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L10
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$27, %r8d
	movl	%ebx, %ecx
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaDeviceReset@PLT
.L10:
	leaq	24(%rsp), %rdi
	movl	$4194304, %esi
	call	cudaMalloc@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L11
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$28, %r8d
	movl	%ebx, %ecx
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaDeviceReset@PLT
.L11:
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movl	$4194304, %edx
	movq	%r13, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L12
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$31, %r8d
	movl	%ebx, %ecx
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaDeviceReset@PLT
.L12:
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movl	$4194304, %edx
	movq	%r12, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L13
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$33, %r8d
	movl	%ebx, %ecx
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaDeviceReset@PLT
.L13:
	movl	$1024, %ecx
	movl	BLOCK_WIDTH(%rip), %edi
	movl	BLOCK_HEIGHT(%rip), %esi
	movl	$1, 56(%rsp)
	movl	%ecx, %eax
	movl	$1, 68(%rsp)
	cltd
	movl	%edi, 48(%rsp)
	idivl	%edi
	movl	%esi, 52(%rsp)
	movl	$2, %edi
	movl	%eax, 60(%rsp)
	movl	%ecx, %eax
	cltd
	idivl	%esi
	leaq	.LC1(%rip), %rsi
	movl	%eax, 64(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	40(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	56(%rsp), %ecx
	movl	68(%rsp), %esi
	xorl	%r9d, %r9d
	movq	48(%rsp), %rdx
	movq	60(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L14
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	movq	24(%rsp), %rdi
	call	_ZL37__device_stub__Z6cuda_1PA1024_fS0_S0_PA1024_fS0_S0_
.L14:
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	40(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	leaq	4(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	40(%rsp), %rdi
	call	cudaEventDestroy@PLT
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movss	4(%rsp), %xmm0
	divss	.LC2(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movq	24(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdi
	movl	$4194304, %edx
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L15
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$64, %r8d
	movl	%ebx, %ecx
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaDeviceReset@PLT
.L15:
	call	cudaDeviceSynchronize@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L8
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$65, %r8d
	movl	%ebx, %ecx
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaDeviceReset@PLT
.L8:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	addq	$88, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	cuda_version_1, .-cuda_version_1
	.globl	_Z8init_matPA1024_f
	.type	_Z8init_matPA1024_f, @function
_Z8init_matPA1024_f:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	4194304(%rdi), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
.L41:
	xorl	%ebp, %ebp
.L42:
	call	rand@PLT
	cvtsi2ssl	%eax, %xmm0
	addss	%xmm0, %xmm0
	mulss	.LC4(%rip), %xmm0
	subss	.LC5(%rip), %xmm0
	movss	%xmm0, (%rbx,%rbp,4)
	incq	%rbp
	cmpq	$1024, %rbp
	jne	.L42
	addq	$4096, %rbx
	cmpq	%r12, %rbx
	jne	.L41
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z8init_matPA1024_f, .-_Z8init_matPA1024_f
	.section	.rodata.str1.1
.LC6:
	.string	"input BLOCK WIDTH , BLOCK HEIGHT : "
.LC7:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	leaq	B(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	A(%rip), %rbx
	pushq	%rax
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	BLOCK_HEIGHT(%rip), %rdx
	leaq	BLOCK_WIDTH(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC7(%rip), %rdi
	call	__isoc23_scanf@PLT
	movq	%rbx, %rdi
	call	_Z8init_matPA1024_f
	movq	%rbp, %rdi
	call	_Z8init_matPA1024_f
	movq	%rbp, %rdx
	movq	%rbx, %rsi
	leaq	C_cuda_1(%rip), %rdi
	call	cuda_version_1
	popq	%rdx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	main, .-main
	.section	.rodata.str1.1
.LC8:
	.string	"_Z6cuda_1PA1024_fS0_S0_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2057:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC8(%rip), %rdx
	movq	%rax, %rdi
	leaq	_ZL6cuda_1PA1024_fS0_S0_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2057:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.globl	C_cuda_1
	.bss
	.align 32
	.type	C_cuda_1, @object
	.size	C_cuda_1, 4194304
C_cuda_1:
	.zero	4194304
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 4194304
B:
	.zero	4194304
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 4194304
A:
	.zero	4194304
	.globl	BLOCK_HEIGHT
	.align 4
	.type	BLOCK_HEIGHT, @object
	.size	BLOCK_HEIGHT, 4
BLOCK_HEIGHT:
	.zero	4
	.globl	BLOCK_WIDTH
	.align 4
	.type	BLOCK_WIDTH, @object
	.size	BLOCK_WIDTH, 4
BLOCK_WIDTH:
	.zero	4
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC2:
	.long	1148846080
	.align 4
.LC4:
	.long	805306368
	.align 4
.LC5:
	.long	1065353216
	.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 <assert.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>



#define CUDA_CALL(x) { const hipError_t a = (x); if(a != hipSuccess) { printf("\nCuda Error: %s (err_num=%d) at line:%d\n", hipGetErrorString(a), a, __LINE__); hipDeviceReset(); assert(0);}}

#define MATRIX_SIZE 1024

int BLOCK_WIDTH,BLOCK_HEIGHT;
void init_mat(float mat[MATRIX_SIZE][MATRIX_SIZE]);
static __global__ void cuda_1(float C[MATRIX_SIZE][MATRIX_SIZE],float A[MATRIX_SIZE][MATRIX_SIZE] , float B[MATRIX_SIZE][MATRIX_SIZE]);

extern "C" void cuda_version_1(float C[MATRIX_SIZE][MATRIX_SIZE],float A[MATRIX_SIZE][MATRIX_SIZE] , float B[MATRIX_SIZE][MATRIX_SIZE])
{

	void *A_dev, *B_dev, *C_dev;

	hipEvent_t start,stop;
	

	CUDA_CALL(hipMalloc((void**)&A_dev, sizeof(float) * MATRIX_SIZE * MATRIX_SIZE));
	CUDA_CALL(hipMalloc((void**)&B_dev, sizeof(float) * MATRIX_SIZE * MATRIX_SIZE));
	CUDA_CALL(hipMalloc((void**)&C_dev, sizeof(float) * MATRIX_SIZE * MATRIX_SIZE));

	// take data from host to device.
	CUDA_CALL(hipMemcpy(A_dev, A, sizeof(float) * MATRIX_SIZE * MATRIX_SIZE,hipMemcpyHostToDevice));

	CUDA_CALL(hipMemcpy(A_dev, B, sizeof(float) * MATRIX_SIZE * MATRIX_SIZE,hipMemcpyHostToDevice));

	dim3 block(BLOCK_WIDTH, BLOCK_HEIGHT);
	dim3 grid(MATRIX_SIZE/BLOCK_WIDTH, MATRIX_SIZE/BLOCK_HEIGHT);
	float dev_time;



	printf("[CUDA 1] Start Launching Kernel.\n");
	//CHECK_TIME_START_GPU();

	hipEventCreate(&start);
	hipEventCreate(&stop);
	hipEventRecord(start, 0);

	cuda_1<<<grid, block>>>((float(*)[MATRIX_SIZE])C_dev, (float(*)[MATRIX_SIZE])A_dev, (float(*)[MATRIX_SIZE])B_dev);

	//CHECK_TIME_END_GPU(dev_time);
	hipEventRecord(stop, 0);
	hipEventSynchronize(stop);

	hipEventElapsedTime(&dev_time, start, stop);
	
	hipEventDestroy(start);
	hipEventDestroy(stop);
	printf("[CUDA 1] Processing Elapsed Time : %.3f (sec).\n",dev_time/1000);




	//take result from device to host.
	CUDA_CALL(hipMemcpy( C, C_dev, sizeof(float) * MATRIX_SIZE* MATRIX_SIZE, hipMemcpyDeviceToHost));
	CUDA_CALL( hipDeviceSynchronize() );


}
static __global__ void cuda_1(float C[MATRIX_SIZE][MATRIX_SIZE],float A[MATRIX_SIZE][MATRIX_SIZE] , float B[MATRIX_SIZE][MATRIX_SIZE])
{
	int col = blockIdx.x * blockDim.x + threadIdx.x;
	int row = blockIdx.y * blockDim.y + threadIdx.y;
	float result = 0.0f;

	for(int i = 0 ; i < MATRIX_SIZE; ++i)
	{
		result += A[row][i] * B[i][col];
	}
	C[row][col] = result;


}

void init_mat(float mat[MATRIX_SIZE][MATRIX_SIZE])
{
	for (int i = 0 ; i < MATRIX_SIZE; ++i)
		for(int j = 0 ; j < MATRIX_SIZE; ++j)
			mat[i][j] = ( (float) rand()*2.f/RAND_MAX ) - 1.f;

}

float A[MATRIX_SIZE][MATRIX_SIZE],B[MATRIX_SIZE][MATRIX_SIZE],C_cuda_1[MATRIX_SIZE][MATRIX_SIZE];

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

	printf("input BLOCK WIDTH , BLOCK HEIGHT : ");
	scanf("%d %d",&BLOCK_WIDTH,&BLOCK_HEIGHT);
	init_mat(A);
	init_mat(B);

	cuda_version_1(C_cuda_1, A, B);


}

	.text
	.file	"cuda.hip"
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function cuda_version_1
.LCPI0_0:
	.long	0x447a0000                      # float 1000
	.text
	.globl	cuda_version_1
	.type	cuda_version_1,@function
cuda_version_1:                         # @cuda_version_1
	.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$48, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	leaq	8(%rsp), %rdi
	movl	$4194304, %esi                  # imm = 0x400000
	callq	hipMalloc
	testl	%eax, %eax
	je	.LBB0_2
# %bb.1:
	movl	%eax, %ebp
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	movl	%ebp, %edx
	movl	$26, %ecx
	xorl	%eax, %eax
	callq	printf
	callq	hipDeviceReset
.LBB0_2:
	leaq	32(%rsp), %rdi
	movl	$4194304, %esi                  # imm = 0x400000
	callq	hipMalloc
	testl	%eax, %eax
	je	.LBB0_4
# %bb.3:
	movl	%eax, %ebp
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	movl	%ebp, %edx
	movl	$27, %ecx
	xorl	%eax, %eax
	callq	printf
	callq	hipDeviceReset
.LBB0_4:
	leaq	24(%rsp), %rdi
	movl	$4194304, %esi                  # imm = 0x400000
	callq	hipMalloc
	testl	%eax, %eax
	je	.LBB0_6
# %bb.5:
	movl	%eax, %ebp
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	movl	%ebp, %edx
	movl	$28, %ecx
	xorl	%eax, %eax
	callq	printf
	callq	hipDeviceReset
.LBB0_6:
	movq	8(%rsp), %rdi
	movl	$4194304, %edx                  # imm = 0x400000
	movq	%r15, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	je	.LBB0_8
# %bb.7:
	movl	%eax, %ebp
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	movl	%ebp, %edx
	movl	$31, %ecx
	xorl	%eax, %eax
	callq	printf
	callq	hipDeviceReset
.LBB0_8:
	movq	8(%rsp), %rdi
	movl	$4194304, %edx                  # imm = 0x400000
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	je	.LBB0_10
# %bb.9:
	movl	%eax, %ebp
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	movl	%ebp, %edx
	movl	$33, %ecx
	xorl	%eax, %eax
	callq	printf
	callq	hipDeviceReset
.LBB0_10:
	movl	BLOCK_WIDTH(%rip), %ecx
	movl	BLOCK_HEIGHT(%rip), %r15d
	movl	$1024, %eax                     # imm = 0x400
	xorl	%edx, %edx
	idivl	%ecx
	movl	%eax, %r14d
	movl	$1024, %eax                     # imm = 0x400
	xorl	%edx, %edx
	idivl	%r15d
                                        # kill: def $eax killed $eax def $rax
	shlq	$32, %r15
	orq	%rcx, %r15
	shlq	$32, %rax
	orq	%rax, %r14
	movl	$.Lstr, %edi
	callq	puts@PLT
	leaq	16(%rsp), %r12
	movq	%r12, %rdi
	callq	hipEventCreate
	movq	%rsp, %rdi
	callq	hipEventCreate
	movq	(%r12), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_12
# %bb.11:
	movq	24(%rsp), %rdi
	movq	8(%rsp), %rsi
	movq	32(%rsp), %rdx
	callq	_ZL21__device_stub__cuda_1PA1024_fS0_S0_
.LBB0_12:
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	44(%rsp), %r14
	movq	%r14, %rdi
	callq	hipEventElapsedTime
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	movq	(%rsp), %rdi
	callq	hipEventDestroy
	movss	(%r14), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI0_0(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	movq	24(%rsp), %rsi
	movl	$4194304, %edx                  # imm = 0x400000
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	je	.LBB0_14
# %bb.13:
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	movl	%ebx, %edx
	movl	$64, %ecx
	xorl	%eax, %eax
	callq	printf
	callq	hipDeviceReset
.LBB0_14:
	callq	hipDeviceSynchronize
	testl	%eax, %eax
	je	.LBB0_16
# %bb.15:
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	movl	%ebx, %edx
	movl	$65, %ecx
	xorl	%eax, %eax
	callq	printf
	callq	hipDeviceReset
.LBB0_16:
	addq	$48, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	cuda_version_1, .Lfunc_end0-cuda_version_1
	.cfi_endproc
                                        # -- End function
	.type	_ZL21__device_stub__cuda_1PA1024_fS0_S0_,@function # -- Begin function _ZL21__device_stub__cuda_1PA1024_fS0_S0_
_ZL21__device_stub__cuda_1PA1024_fS0_S0_: # @_ZL21__device_stub__cuda_1PA1024_fS0_S0_
	.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	$_ZL6cuda_1PA1024_fS0_S0_, %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_end1:
	.size	_ZL21__device_stub__cuda_1PA1024_fS0_S0_, .Lfunc_end1-_ZL21__device_stub__cuda_1PA1024_fS0_S0_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z8init_matPA1024_f
.LCPI2_0:
	.long	0x30000000                      # float 4.65661287E-10
.LCPI2_1:
	.long	0xbf800000                      # float -1
	.text
	.globl	_Z8init_matPA1024_f
	.type	_Z8init_matPA1024_f,@function
_Z8init_matPA1024_f:                    # @_Z8init_matPA1024_f
	.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
.LBB2_1:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_2 Depth 2
	xorl	%r15d, %r15d
.LBB2_2:                                #   Parent Loop BB2_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	movss	.LCPI2_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	addss	%xmm0, %xmm0
	mulss	%xmm1, %xmm0
	movss	.LCPI2_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	addss	%xmm1, %xmm0
	movss	%xmm0, (%rbx,%r15,4)
	incq	%r15
	cmpq	$1024, %r15                     # imm = 0x400
	jne	.LBB2_2
# %bb.3:                                #   in Loop: Header=BB2_1 Depth=1
	incq	%r14
	addq	$4096, %rbx                     # imm = 0x1000
	cmpq	$1024, %r14                     # imm = 0x400
	jne	.LBB2_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_end2:
	.size	_Z8init_matPA1024_f, .Lfunc_end2-_Z8init_matPA1024_f
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.4, %edi
	movl	$BLOCK_WIDTH, %esi
	movl	$BLOCK_HEIGHT, %edx
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movl	$A, %edi
	callq	_Z8init_matPA1024_f
	movl	$B, %edi
	callq	_Z8init_matPA1024_f
	movl	$C_cuda_1, %edi
	movl	$A, %esi
	movl	$B, %edx
	callq	cuda_version_1
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_ZL6cuda_1PA1024_fS0_S0_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__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	.LBB5_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
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	BLOCK_WIDTH,@object             # @BLOCK_WIDTH
	.bss
	.globl	BLOCK_WIDTH
	.p2align	2, 0x0
BLOCK_WIDTH:
	.long	0                               # 0x0
	.size	BLOCK_WIDTH, 4

	.type	BLOCK_HEIGHT,@object            # @BLOCK_HEIGHT
	.globl	BLOCK_HEIGHT
	.p2align	2, 0x0
BLOCK_HEIGHT:
	.long	0                               # 0x0
	.size	BLOCK_HEIGHT, 4

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"\nCuda Error: %s (err_num=%d) at line:%d\n"
	.size	.L.str, 41

	.type	_ZL6cuda_1PA1024_fS0_S0_,@object # @_ZL6cuda_1PA1024_fS0_S0_
	.section	.rodata,"a",@progbits
	.p2align	3, 0x0
_ZL6cuda_1PA1024_fS0_S0_:
	.quad	_ZL21__device_stub__cuda_1PA1024_fS0_S0_
	.size	_ZL6cuda_1PA1024_fS0_S0_, 8

	.type	.L.str.2,@object                # @.str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.2:
	.asciz	"[CUDA 1] Processing Elapsed Time : %.3f (sec).\n"
	.size	.L.str.2, 48

	.type	A,@object                       # @A
	.bss
	.globl	A
	.p2align	4, 0x0
A:
	.zero	4194304
	.size	A, 4194304

	.type	B,@object                       # @B
	.globl	B
	.p2align	4, 0x0
B:
	.zero	4194304
	.size	B, 4194304

	.type	C_cuda_1,@object                # @C_cuda_1
	.globl	C_cuda_1
	.p2align	4, 0x0
C_cuda_1:
	.zero	4194304
	.size	C_cuda_1, 4194304

	.type	.L.str.3,@object                # @.str.3
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.3:
	.asciz	"input BLOCK WIDTH , BLOCK HEIGHT : "
	.size	.L.str.3, 36

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%d %d"
	.size	.L.str.4, 6

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_ZL6cuda_1PA1024_fS0_S0_"
	.size	.L__unnamed_1, 25

	.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	"[CUDA 1] Start Launching Kernel."
	.size	.Lstr, 33

	.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 _ZL21__device_stub__cuda_1PA1024_fS0_S0_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym BLOCK_WIDTH
	.addrsig_sym BLOCK_HEIGHT
	.addrsig_sym _ZL6cuda_1PA1024_fS0_S0_
	.addrsig_sym A
	.addrsig_sym B
	.addrsig_sym C_cuda_1
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.section	.text._ZL6cuda_1PA1024_fS0_S0_,"axG",@progbits,_ZL6cuda_1PA1024_fS0_S0_,comdat
	.globl	_ZL6cuda_1PA1024_fS0_S0_        ; -- Begin function _ZL6cuda_1PA1024_fS0_S0_
	.p2align	8
	.type	_ZL6cuda_1PA1024_fS0_S0_,@function
_ZL6cuda_1PA1024_fS0_S0_:               ; @_ZL6cuda_1PA1024_fS0_S0_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b128 s[4:7], s[0:1], 0x0
	v_bfe_u32 v1, v0, 10, 10
	v_and_b32_e32 v0, 0x3ff, v0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_mov_b32_e32 v6, 0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	v_mad_u64_u32 v[2:3], null, s15, s3, v[1:2]
	v_mad_u64_u32 v[4:5], null, s14, s2, v[0:1]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v3, 31, v2
	v_ashrrev_i32_e32 v5, 31, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[0:1], 12, v[2:3]
	v_lshlrev_b64 v[2:3], 2, v[4:5]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v7, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v8, vcc_lo, s7, v1, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v4, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v3, vcc_lo
	s_mov_b64 s[0:1], 0
.LBB0_1:                                ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	v_add_co_u32 v9, vcc_lo, v7, s0
	v_add_co_ci_u32_e32 v10, vcc_lo, s1, v8, vcc_lo
	s_add_u32 s0, s0, 4
	s_addc_u32 s1, s1, 0
	global_load_b32 v11, v[4:5], off
	global_load_b32 v9, v[9:10], off
	v_add_co_u32 v4, vcc_lo, 0x1000, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
	s_cmpk_eq_i32 s0, 0x1000
	s_waitcnt vmcnt(0)
	v_fmac_f32_e32 v6, v9, v11
	s_cbranch_scc0 .LBB0_1
; %bb.2:
	v_add_co_u32 v0, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, v0, v2
	v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
	global_store_b32 v[0:1], v6, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _ZL6cuda_1PA1024_fS0_S0_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.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
	.section	.text._ZL6cuda_1PA1024_fS0_S0_,"axG",@progbits,_ZL6cuda_1PA1024_fS0_S0_,comdat
.Lfunc_end0:
	.size	_ZL6cuda_1PA1024_fS0_S0_, .Lfunc_end0-_ZL6cuda_1PA1024_fS0_S0_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 268
; NumSgprs: 18
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 12
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

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

	.end_amdgpu_metadata
