
#include <stdio.h>
#include <cuda.h>

#define ARRAY_SIZE 2097120
#define N 5
#define HLINE "----------------------------------------------------\n"
#define NTIMES 10

void printResults();
void printDeviceDetails();
void cudaSafeMalloc(void ** , size_t );
void CudaGetDeviceProperties(cudaDeviceProp *, int);
void CudaGetDevice(int *);
void checkCudaErrors();


float avgTime[N] = {0};

static int blockSize[] = {32,64,128,256,512};


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Simple Copy Kernel
// It copies one array on device to other
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

__global__ void simpleCopyKernel(float* dest,float* src,long size)
{
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	if(idx < size)
		dest[idx] = src[idx];
}




//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Kernel for initializing the array on device  with given element
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

__global__ void setArray(float *array,  float value, int size)
{
	int idx = threadIdx.x + blockIdx.x * blockDim.x;
	if (idx < size)
		array[idx] = value;
}






////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Main Routine 
// for timing the copy kernel printing the results
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main(int argc,char* argv[])
{
	int i,j;
	float *d_srcArray , *d_destArray;
	//float bandWidths[N];
	float elapsedTimes[N][NTIMES];
	cudaEvent_t start,stop;
	

	int gridSize[N];
	
	// allocating the memory for the two arrays on the device
	cudaSafeMalloc((void **)&d_srcArray,ARRAY_SIZE*sizeof(float));
	cudaSafeMalloc((void **)&d_destArray,ARRAY_SIZE*sizeof(float));
	
	// event creation, which will be used for timing the code
	cudaEventCreate(&start);
	cudaEventCreate(&stop);
	
	for(j=0; j< NTIMES; j++)
	{
		for(i=0; i<N; i++)
		{
			//finding the 1D grid size 
			gridSize[i] = ARRAY_SIZE/blockSize[i];
	
			if( ARRAY_SIZE % blockSize[i] != 0)
			gridSize[i] += 1;
	
			// intializing the arrays on the device
			setArray <<< gridSize[i],blockSize[i] >>> (d_srcArray,1.0f,ARRAY_SIZE);
			setArray <<< gridSize[i],blockSize[i] >>> (d_destArray,0.0f,ARRAY_SIZE);

			cudaThreadSynchronize();

   		// timing the copy routine for different Block Sizes 
			cudaEventRecord(start,0);
			simpleCopyKernel <<< gridSize[i],blockSize[i] >>> (d_destArray,d_srcArray,ARRAY_SIZE);
			cudaEventRecord(stop,0);
			cudaEventSynchronize(stop);
			cudaEventElapsedTime(&elapsedTimes[i][j],start,stop);

		}
	
	}
	
	//Computing average time
	for(i=0; i<N; i++)
	{
		for(j=1; j<NTIMES; j++) //skipping first iteration
		{
			avgTime[i] += elapsedTimes[i][j];
		}
		avgTime[i] = avgTime[i]/(NTIMES-1);
	}
	
	// Printing the results 
	printResults();
	
	cudaEventDestroy(start);
	cudaEventDestroy(stop);

	return 0;
}



////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Host Function to print the results
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

void printResults()
{
	int j;
	printf("\n\n");
	printf(HLINE);
	printf("BLOCK PARTITIONING ANALYSIS\n");
	printf(HLINE);
	printDeviceDetails();
	printf(HLINE);
	printf("Array Size = %llu\n",(unsigned long long)ARRAY_SIZE);
	//printf("Block Size = %d\n",(int)BLOCK_SIZE);
	printf(HLINE);
 
	printf("Block Size    Rate (GB/s)   Avg time  \n");
   for (j=0; j<N; j++) 
	{
		printf("%3.1d%20.4f  %11.4f  \n", blockSize[j], 1.0E-06 * (2 * ARRAY_SIZE * sizeof(float))/avgTime[j],avgTime[j]);
	} 
	
	printf(HLINE);
}

void printDeviceDetails()
{
	int deviceId;
	cudaDeviceProp prop;
	CudaGetDevice(&deviceId);
	 
	CudaGetDeviceProperties(&prop, deviceId);
	
	printf("Device Name is %s\n", prop.name);
	//printf("Clock Rate of this device is %f GHz\n",(float)prop.clockRate * 1.0E-06);
	printf("Compute Capability of this device is %d.%d\n",prop.major,prop.minor);
	printf("Number of Multiprocessors = %d\n", prop.multiProcessorCount);
	printf("Max no. of blocks allowed in a 1D Grid = %d\n", prop.maxGridSize[0]);
	//printf("Max no. of threads allowed in 1D block = %d\n", prop.maxThreadsDim[0]);
	printf("Max no. of threads allowed in a block = %d\n", prop.maxThreadsPerBlock);
	//printf("No. of registers per block = %d\n", prop.regsPerBlock);
	//printf("Shared Memory Per block (in KB) = %f\n", (float)prop.sharedMemPerBlock * 1.0E-03);
	printf("Total Global Memory available = %f GB\n",(float)prop.totalGlobalMem * 1.0E-09);
	printf("Warp Size in threads = %d\n",prop.warpSize);
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Wrapper Fuctions for error checking
//////////////////////////////////////////////////////////////////////////////////////////////////////////

void cudaSafeMalloc(void ** devicePtr, size_t size)
{
	cudaMalloc(devicePtr, size);
	checkCudaErrors();
}

void CudaGetDeviceProperties(cudaDeviceProp *devicePropPtr, int deviceId)
{
	cudaGetDeviceProperties(devicePropPtr, deviceId);
	checkCudaErrors();
}

void CudaGetDevice(int *deviceIdPtr)
{
	cudaGetDevice(deviceIdPtr);
	checkCudaErrors();
}

void checkCudaErrors()
{
	cudaError_t error = cudaGetLastError();
	if(error != cudaSuccess)
	{   
   	printf("Cuda Error: %s\n",cudaGetErrorString(error));
   	cudaThreadExit();
		exit(-1);
	}
}

	.file	"tmpxft_0036145e_00000000-6_blockPartitioning.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2036:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2036:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Cuda Error: %s\n"
	.text
	.globl	_Z15checkCudaErrorsv
	.type	_Z15checkCudaErrorsv, @function
_Z15checkCudaErrorsv:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%rdx
	.cfi_def_cfa_offset 16
	call	cudaGetLastError@PLT
	testl	%eax, %eax
	je	.L2
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$2, %edi
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	cudaThreadExit@PLT
	orl	$-1, %edi
	call	exit@PLT
.L2:
	popq	%rax
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z15checkCudaErrorsv, .-_Z15checkCudaErrorsv
	.globl	_Z14cudaSafeMallocPPvm
	.type	_Z14cudaSafeMallocPPvm, @function
_Z14cudaSafeMallocPPvm:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	cudaMalloc@PLT
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	_Z15checkCudaErrorsv
	.cfi_endproc
.LFE2030:
	.size	_Z14cudaSafeMallocPPvm, .-_Z14cudaSafeMallocPPvm
	.globl	_Z23CudaGetDevicePropertiesP14cudaDevicePropi
	.type	_Z23CudaGetDevicePropertiesP14cudaDevicePropi, @function
_Z23CudaGetDevicePropertiesP14cudaDevicePropi:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	cudaGetDeviceProperties_v2@PLT
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	_Z15checkCudaErrorsv
	.cfi_endproc
.LFE2031:
	.size	_Z23CudaGetDevicePropertiesP14cudaDevicePropi, .-_Z23CudaGetDevicePropertiesP14cudaDevicePropi
	.globl	_Z13CudaGetDevicePi
	.type	_Z13CudaGetDevicePi, @function
_Z13CudaGetDevicePi:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	cudaGetDevice@PLT
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	_Z15checkCudaErrorsv
	.cfi_endproc
.LFE2032:
	.size	_Z13CudaGetDevicePi, .-_Z13CudaGetDevicePi
	.section	.rodata.str1.1
.LC1:
	.string	"Device Name is %s\n"
.LC2:
	.string	"Compute Capability of this device is %d.%d\n"
.LC3:
	.string	"Number of Multiprocessors = %d\n"
.LC4:
	.string	"Max no. of blocks allowed in a 1D Grid = %d\n"
.LC5:
	.string	"Max no. of threads allowed in a block = %d\n"
.LC7:
	.string	"Total Global Memory available = %f GB\n"
.LC8:
	.string	"Warp Size in threads = %d\n"
	.text
	.globl	_Z18printDeviceDetailsv
	.type	_Z18printDeviceDetailsv, @function
_Z18printDeviceDetailsv:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	subq	$1056, %rsp
	.cfi_def_cfa_offset 1072
	movq	%fs:40, %rax
	movq	%rax, 1048(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdi
	leaq	16(%rsp), %rbx
	call	_Z13CudaGetDevicePi
	movl	12(%rsp), %esi
	movq	%rbx, %rdi
	call	_Z23CudaGetDevicePropertiesP14cudaDevicePropi
	movq	%rbx, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movl	380(%rsp), %ecx
	movl	$2, %edi
	xorl	%eax, %eax
	movl	376(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movl	404(%rsp), %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	352(%rsp), %edx
	leaq	.LC4(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	336(%rsp), %edx
	leaq	.LC5(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	304(%rsp), %rax
	testq	%rax, %rax
	js	.L13
	cvtsi2ssq	%rax, %xmm0
	jmp	.L14
.L13:
	movq	%rax, %rdx
	andl	$1, %eax
	shrq	%rdx
	orq	%rax, %rdx
	cvtsi2ssq	%rdx, %xmm0
	addss	%xmm0, %xmm0
.L14:
	cvtss2sd	%xmm0, %xmm0
	leaq	.LC7(%rip), %rsi
	mulsd	.LC6(%rip), %xmm0
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	movl	324(%rsp), %edx
	xorl	%eax, %eax
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	1048(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$1056, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z18printDeviceDetailsv, .-_Z18printDeviceDetailsv
	.section	.rodata.str1.1
.LC9:
	.string	"\n\n"
.LC10:
	.string	"----------------------------------------------------\n"
.LC11:
	.string	"BLOCK PARTITIONING ANALYSIS\n"
.LC12:
	.string	"Array Size = %llu\n"
.LC13:
	.string	"Block Size    Rate (GB/s)   Avg time  \n"
.LC15:
	.string	"%3.1d%20.4f  %11.4f  \n"
	.text
	.globl	_Z12printResultsv
	.type	_Z12printResultsv, @function
_Z12printResultsv:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	_ZL9blockSize(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	avgTime(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC10(%rip), %rbx
	leaq	20(%rbp), %r13
	pushq	%rcx
	.cfi_def_cfa_offset 48
	call	__printf_chk@PLT
	movq	%rbx, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	_Z18printDeviceDetailsv
	movq	%rbx, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$2097120, %edx
	leaq	.LC12(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	%rbx, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	cvtss2sd	0(%rbp), %xmm1
	movl	(%r12), %edx
	movb	$2, %al
	movsd	.LC14(%rip), %xmm0
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	addq	$4, %rbp
	addq	$4, %r12
	divsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	cmpq	%r13, %rbp
	jne	.L18
	popq	%rdx
	.cfi_def_cfa_offset 40
	movq	%rbx, %rsi
	movl	$2, %edi
	popq	%rbx
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z12printResultsv, .-_Z12printResultsv
	.globl	_Z39__device_stub__Z16simpleCopyKernelPfS_lPfS_l
	.type	_Z39__device_stub__Z16simpleCopyKernelPfS_lPfS_l, @function
_Z39__device_stub__Z16simpleCopyKernelPfS_lPfS_l:
.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	.L21
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z16simpleCopyKernelPfS_l(%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
.L21:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z39__device_stub__Z16simpleCopyKernelPfS_lPfS_l, .-_Z39__device_stub__Z16simpleCopyKernelPfS_lPfS_l
	.globl	_Z16simpleCopyKernelPfS_l
	.type	_Z16simpleCopyKernelPfS_l, @function
_Z16simpleCopyKernelPfS_l:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z39__device_stub__Z16simpleCopyKernelPfS_lPfS_l
	.cfi_endproc
.LFE2059:
	.size	_Z16simpleCopyKernelPfS_l, .-_Z16simpleCopyKernelPfS_l
	.globl	_Z29__device_stub__Z8setArrayPffiPffi
	.type	_Z29__device_stub__Z8setArrayPffiPffi, @function
_Z29__device_stub__Z8setArrayPffiPffi:
.LFB2060:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	16(%rsp), %rdx
	movl	%esi, (%rsp)
	leaq	32(%rsp), %rdi
	leaq	44(%rsp), %rsi
	movss	%xmm0, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L26
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z8setArrayPffi(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L26:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2060:
	.size	_Z29__device_stub__Z8setArrayPffiPffi, .-_Z29__device_stub__Z8setArrayPffiPffi
	.globl	_Z8setArrayPffi
	.type	_Z8setArrayPffi, @function
_Z8setArrayPffi:
.LFB2061:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z8setArrayPffiPffi
	.cfi_endproc
.LFE2061:
	.size	_Z8setArrayPffi, .-_Z8setArrayPffi
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$8388480, %esi
	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	$328, %rsp
	.cfi_def_cfa_offset 384
	movq	%fs:40, %rax
	movq	%rax, 312(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rdi
	leaq	112(%rsp), %rbx
	call	_Z14cudaSafeMallocPPvm
	movl	$8388480, %esi
	leaq	40(%rsp), %rdi
	call	_Z14cudaSafeMallocPPvm
	leaq	48(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	56(%rsp), %rdi
	call	cudaEventCreate@PLT
	xorl	%eax, %eax
	movq	%rbx, 24(%rsp)
	movq	%rax, 16(%rsp)
.L32:
	movq	24(%rsp), %rax
	leaq	92(%rsp), %r12
	leaq	_ZL9blockSize(%rip), %r14
	movabsq	$4294967297, %rbp
	movq	%rax, 8(%rsp)
.L38:
	movl	$2097120, %eax
	movl	(%r14), %r13d
	cltd
	idivl	%r13d
	testl	%edx, %edx
	je	.L47
	incl	%eax
.L47:
	movl	%eax, (%r12)
	movl	(%r12), %r15d
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rbp, 84(%rsp)
	movl	88(%rsp), %ecx
	movq	%rbp, 72(%rsp)
	movl	76(%rsp), %esi
	movl	%r13d, 80(%rsp)
	movq	80(%rsp), %rdx
	movl	%r15d, 68(%rsp)
	movq	68(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L35
	movss	.LC16(%rip), %xmm0
	movq	32(%rsp), %rdi
	movl	$2097120, %esi
	call	_Z29__device_stub__Z8setArrayPffiPffi
.L35:
	movq	%rbp, 84(%rsp)
	movl	88(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rbp, 72(%rsp)
	movl	76(%rsp), %esi
	movl	%r13d, 80(%rsp)
	movq	80(%rsp), %rdx
	movl	%r15d, 68(%rsp)
	movq	68(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L36
	movq	40(%rsp), %rdi
	movl	$2097120, %esi
	xorps	%xmm0, %xmm0
	call	_Z29__device_stub__Z8setArrayPffiPffi
.L36:
	call	cudaThreadSynchronize@PLT
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	%rbp, 84(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rbp, 72(%rsp)
	movl	88(%rsp), %ecx
	movl	%r13d, 80(%rsp)
	movl	76(%rsp), %esi
	movl	%r15d, 68(%rsp)
	movq	80(%rsp), %rdx
	movq	68(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L37
	movq	32(%rsp), %rsi
	movq	40(%rsp), %rdi
	movl	$2097120, %edx
	call	_Z39__device_stub__Z16simpleCopyKernelPfS_lPfS_l
.L37:
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	addq	$4, %r14
	addq	$4, %r12
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	20+_ZL9blockSize(%rip), %rax
	addq	$40, 8(%rsp)
	cmpq	%rax, %r14
	jne	.L38
	incq	16(%rsp)
	addq	$4, 24(%rsp)
	cmpq	$10, 16(%rsp)
	jne	.L32
	movss	.LC18(%rip), %xmm1
	leaq	avgTime(%rip), %rdx
	leaq	200(%rbx), %rcx
.L39:
	movss	(%rdx), %xmm0
	movl	$1, %eax
.L40:
	addss	(%rbx,%rax,4), %xmm0
	incq	%rax
	cmpq	$10, %rax
	jne	.L40
	divss	%xmm1, %xmm0
	addq	$40, %rbx
	addq	$4, %rdx
	movss	%xmm0, -4(%rdx)
	cmpq	%rcx, %rbx
	jne	.L39
	call	_Z12printResultsv
	movq	48(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	56(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	312(%rsp), %rax
	subq	%fs:40, %rax
	je	.L42
	call	__stack_chk_fail@PLT
.L42:
	addq	$328, %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
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC19:
	.string	"_Z8setArrayPffi"
.LC20:
	.string	"_Z16simpleCopyKernelPfS_l"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2063:
	.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	.LC19(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z8setArrayPffi(%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	.LC20(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z16simpleCopyKernelPfS_l(%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
.LFE2063:
	.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
	.align 16
	.type	_ZL9blockSize, @object
	.size	_ZL9blockSize, 20
_ZL9blockSize:
	.long	32
	.long	64
	.long	128
	.long	256
	.long	512
	.globl	avgTime
	.bss
	.align 16
	.type	avgTime, @object
	.size	avgTime, 20
avgTime:
	.zero	20
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC6:
	.long	-400107883
	.long	1041313291
	.align 8
.LC14:
	.long	-641839913
	.long	1076938470
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC16:
	.long	1065353216
	.align 4
.LC18:
	.long	1091567616
	.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 <hip/hip_runtime.h>

#define ARRAY_SIZE 2097120
#define N 5
#define HLINE "----------------------------------------------------\n"
#define NTIMES 10

void printResults();
void printDeviceDetails();
void cudaSafeMalloc(void ** , size_t );
void CudaGetDeviceProperties(hipDeviceProp_t *, int);
void CudaGetDevice(int *);
void checkCudaErrors();


float avgTime[N] = {0};

static int blockSize[] = {32,64,128,256,512};


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Simple Copy Kernel
// It copies one array on device to other
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

__global__ void simpleCopyKernel(float* dest,float* src,long size)
{
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	if(idx < size)
		dest[idx] = src[idx];
}




//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Kernel for initializing the array on device  with given element
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

__global__ void setArray(float *array,  float value, int size)
{
	int idx = threadIdx.x + blockIdx.x * blockDim.x;
	if (idx < size)
		array[idx] = value;
}






////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Main Routine 
// for timing the copy kernel printing the results
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main(int argc,char* argv[])
{
	int i,j;
	float *d_srcArray , *d_destArray;
	//float bandWidths[N];
	float elapsedTimes[N][NTIMES];
	hipEvent_t start,stop;
	

	int gridSize[N];
	
	// allocating the memory for the two arrays on the device
	cudaSafeMalloc((void **)&d_srcArray,ARRAY_SIZE*sizeof(float));
	cudaSafeMalloc((void **)&d_destArray,ARRAY_SIZE*sizeof(float));
	
	// event creation, which will be used for timing the code
	hipEventCreate(&start);
	hipEventCreate(&stop);
	
	for(j=0; j< NTIMES; j++)
	{
		for(i=0; i<N; i++)
		{
			//finding the 1D grid size 
			gridSize[i] = ARRAY_SIZE/blockSize[i];
	
			if( ARRAY_SIZE % blockSize[i] != 0)
			gridSize[i] += 1;
	
			// intializing the arrays on the device
			setArray <<< gridSize[i],blockSize[i] >>> (d_srcArray,1.0f,ARRAY_SIZE);
			setArray <<< gridSize[i],blockSize[i] >>> (d_destArray,0.0f,ARRAY_SIZE);

			hipDeviceSynchronize();

   		// timing the copy routine for different Block Sizes 
			hipEventRecord(start,0);
			simpleCopyKernel <<< gridSize[i],blockSize[i] >>> (d_destArray,d_srcArray,ARRAY_SIZE);
			hipEventRecord(stop,0);
			hipEventSynchronize(stop);
			hipEventElapsedTime(&elapsedTimes[i][j],start,stop);

		}
	
	}
	
	//Computing average time
	for(i=0; i<N; i++)
	{
		for(j=1; j<NTIMES; j++) //skipping first iteration
		{
			avgTime[i] += elapsedTimes[i][j];
		}
		avgTime[i] = avgTime[i]/(NTIMES-1);
	}
	
	// Printing the results 
	printResults();
	
	hipEventDestroy(start);
	hipEventDestroy(stop);

	return 0;
}



////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Host Function to print the results
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

void printResults()
{
	int j;
	printf("\n\n");
	printf(HLINE);
	printf("BLOCK PARTITIONING ANALYSIS\n");
	printf(HLINE);
	printDeviceDetails();
	printf(HLINE);
	printf("Array Size = %llu\n",(unsigned long long)ARRAY_SIZE);
	//printf("Block Size = %d\n",(int)BLOCK_SIZE);
	printf(HLINE);
 
	printf("Block Size    Rate (GB/s)   Avg time  \n");
   for (j=0; j<N; j++) 
	{
		printf("%3.1d%20.4f  %11.4f  \n", blockSize[j], 1.0E-06 * (2 * ARRAY_SIZE * sizeof(float))/avgTime[j],avgTime[j]);
	} 
	
	printf(HLINE);
}

void printDeviceDetails()
{
	int deviceId;
	hipDeviceProp_t prop;
	CudaGetDevice(&deviceId);
	 
	CudaGetDeviceProperties(&prop, deviceId);
	
	printf("Device Name is %s\n", prop.name);
	//printf("Clock Rate of this device is %f GHz\n",(float)prop.clockRate * 1.0E-06);
	printf("Compute Capability of this device is %d.%d\n",prop.major,prop.minor);
	printf("Number of Multiprocessors = %d\n", prop.multiProcessorCount);
	printf("Max no. of blocks allowed in a 1D Grid = %d\n", prop.maxGridSize[0]);
	//printf("Max no. of threads allowed in 1D block = %d\n", prop.maxThreadsDim[0]);
	printf("Max no. of threads allowed in a block = %d\n", prop.maxThreadsPerBlock);
	//printf("No. of registers per block = %d\n", prop.regsPerBlock);
	//printf("Shared Memory Per block (in KB) = %f\n", (float)prop.sharedMemPerBlock * 1.0E-03);
	printf("Total Global Memory available = %f GB\n",(float)prop.totalGlobalMem * 1.0E-09);
	printf("Warp Size in threads = %d\n",prop.warpSize);
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Wrapper Fuctions for error checking
//////////////////////////////////////////////////////////////////////////////////////////////////////////

void cudaSafeMalloc(void ** devicePtr, size_t size)
{
	hipMalloc(devicePtr, size);
	checkCudaErrors();
}

void CudaGetDeviceProperties(hipDeviceProp_t *devicePropPtr, int deviceId)
{
	hipGetDeviceProperties(devicePropPtr, deviceId);
	checkCudaErrors();
}

void CudaGetDevice(int *deviceIdPtr)
{
	hipGetDevice(deviceIdPtr);
	checkCudaErrors();
}

void checkCudaErrors()
{
	hipError_t error = hipGetLastError();
	if(error != hipSuccess)
	{   
   	printf("Cuda Error: %s\n",hipGetErrorString(error));
   	hipDeviceReset();
		exit(-1);
	}
}

	.text
	.file	"blockPartitioning.hip"
	.globl	_Z31__device_stub__simpleCopyKernelPfS_l # -- Begin function _Z31__device_stub__simpleCopyKernelPfS_l
	.type	_Z31__device_stub__simpleCopyKernelPfS_l,@function
_Z31__device_stub__simpleCopyKernelPfS_l: # @_Z31__device_stub__simpleCopyKernelPfS_l
	.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	$_Z16simpleCopyKernelPfS_l, %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_end0:
	.size	_Z31__device_stub__simpleCopyKernelPfS_l, .Lfunc_end0-_Z31__device_stub__simpleCopyKernelPfS_l
	.cfi_endproc
                                        # -- End function
	.globl	_Z23__device_stub__setArrayPffi # -- Begin function _Z23__device_stub__setArrayPffi
	.type	_Z23__device_stub__setArrayPffi,@function
_Z23__device_stub__setArrayPffi:        # @_Z23__device_stub__setArrayPffi
	.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	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	4(%rsp), %rcx
	movss	%xmm0, (%rcx)
	movq	%rsp, %rdx
	movl	%esi, (%rdx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rdx, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%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	$_Z8setArrayPffi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$112, %rsp
	.cfi_adjust_cfa_offset -112
	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	_Z23__device_stub__setArrayPffi, .Lfunc_end1-_Z23__device_stub__setArrayPffi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI2_0:
	.long	0x3f800000                      # float 1
.LCPI2_1:
	.long	0x41100000                      # float 9
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$248, %rsp
	.cfi_def_cfa_offset 304
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movabsq	$4294967296, %r12               # imm = 0x100000000
	leaq	32(%rsp), %rdi
	movl	$8388480, %esi                  # imm = 0x7FFF80
	callq	hipMalloc
	callq	_Z15checkCudaErrorsv
	leaq	24(%rsp), %rdi
	movl	$8388480, %esi                  # imm = 0x7FFF80
	callq	hipMalloc
	callq	_Z15checkCudaErrorsv
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	leaq	48(%rsp), %r13
	xorl	%eax, %eax
.LBB2_1:                                # %.preheader56
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_2 Depth 2
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	movq	$-20, %rbp
	movq	%r13, %rbx
.LBB2_2:                                #   Parent Loop BB2_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	_ZL9blockSize+20(%rbp), %r14d
	movl	$2097120, %eax                  # imm = 0x1FFFE0
	xorl	%edx, %edx
	idivl	%r14d
	movl	%eax, %r15d
	cmpl	$1, %edx
	sbbl	$-1, %r15d
	orq	%r12, %r15
	orq	%r12, %r14
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_4
# %bb.3:                                #   in Loop: Header=BB2_2 Depth=2
	movq	32(%rsp), %rdi
	movss	.LCPI2_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movl	$2097120, %esi                  # imm = 0x1FFFE0
	callq	_Z23__device_stub__setArrayPffi
.LBB2_4:                                #   in Loop: Header=BB2_2 Depth=2
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_6
# %bb.5:                                #   in Loop: Header=BB2_2 Depth=2
	movq	24(%rsp), %rdi
	xorps	%xmm0, %xmm0
	movl	$2097120, %esi                  # imm = 0x1FFFE0
	callq	_Z23__device_stub__setArrayPffi
.LBB2_6:                                #   in Loop: Header=BB2_2 Depth=2
	callq	hipDeviceSynchronize
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	%r15, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_8
# %bb.7:                                #   in Loop: Header=BB2_2 Depth=2
	movq	24(%rsp), %rdi
	movq	32(%rsp), %rsi
	movl	$2097120, %edx                  # imm = 0x1FFFE0
	callq	_Z31__device_stub__simpleCopyKernelPfS_l
.LBB2_8:                                #   in Loop: Header=BB2_2 Depth=2
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	addq	$40, %rbx
	addq	$4, %rbp
	jne	.LBB2_2
# %bb.9:                                #   in Loop: Header=BB2_1 Depth=1
	movq	40(%rsp), %rax                  # 8-byte Reload
	incq	%rax
	addq	$4, %r13
	cmpq	$10, %rax
	jne	.LBB2_1
# %bb.10:                               # %.preheader.preheader
	leaq	48(%rsp), %rax
	xorl	%ecx, %ecx
	movss	.LCPI2_1(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
.LBB2_11:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_12 Depth 2
	movss	avgTime(,%rcx,4), %xmm1         # xmm1 = mem[0],zero,zero,zero
	movl	$1, %edx
.LBB2_12:                               #   Parent Loop BB2_11 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	addss	(%rax,%rdx,4), %xmm1
	incq	%rdx
	cmpq	$10, %rdx
	jne	.LBB2_12
# %bb.13:                               #   in Loop: Header=BB2_11 Depth=1
	divss	%xmm0, %xmm1
	movss	%xmm1, avgTime(,%rcx,4)
	incq	%rcx
	addq	$40, %rax
	cmpq	$5, %rcx
	jne	.LBB2_11
# %bb.14:
	callq	_Z12printResultsv
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	movq	8(%rsp), %rdi
	callq	hipEventDestroy
	xorl	%eax, %eax
	addq	$248, %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_end2:
	.size	main, .Lfunc_end2-main
	.cfi_endproc
                                        # -- End function
	.globl	_Z14cudaSafeMallocPPvm          # -- Begin function _Z14cudaSafeMallocPPvm
	.type	_Z14cudaSafeMallocPPvm,@function
_Z14cudaSafeMallocPPvm:                 # @_Z14cudaSafeMallocPPvm
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	hipMalloc
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Z15checkCudaErrorsv            # TAILCALL
.Lfunc_end3:
	.size	_Z14cudaSafeMallocPPvm, .Lfunc_end3-_Z14cudaSafeMallocPPvm
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z12printResultsv
.LCPI4_0:
	.quad	0x4030c6e6d9be4cd7              # double 16.776959999999999
	.text
	.globl	_Z12printResultsv
	.type	_Z12printResultsv,@function
_Z12printResultsv:                      # @_Z12printResultsv
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$.Lstr.7, %edi
	callq	puts@PLT
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	$.Lstr.7, %edi
	callq	puts@PLT
	callq	_Z18printDeviceDetailsv
	movl	$.Lstr.7, %edi
	callq	puts@PLT
	movl	$.L.str.3, %edi
	movl	$2097120, %esi                  # imm = 0x1FFFE0
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.7, %edi
	callq	puts@PLT
	movl	$.Lstr.6, %edi
	callq	puts@PLT
	movq	$-20, %rbx
.LBB4_1:                                # =>This Inner Loop Header: Depth=1
	movl	_ZL9blockSize+20(%rbx), %esi
	xorps	%xmm1, %xmm1
	cvtss2sd	avgTime+20(%rbx), %xmm1
	movsd	.LCPI4_0(%rip), %xmm0           # xmm0 = mem[0],zero
	divsd	%xmm1, %xmm0
	movl	$.L.str.5, %edi
	movb	$2, %al
	callq	printf
	addq	$4, %rbx
	jne	.LBB4_1
# %bb.2:
	movl	$.Lstr.7, %edi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	puts@PLT                        # TAILCALL
.Lfunc_end4:
	.size	_Z12printResultsv, .Lfunc_end4-_Z12printResultsv
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z18printDeviceDetailsv
.LCPI5_0:
	.quad	0x3e112e0be826d695              # double 1.0000000000000001E-9
	.text
	.globl	_Z18printDeviceDetailsv
	.type	_Z18printDeviceDetailsv,@function
_Z18printDeviceDetailsv:                # @_Z18printDeviceDetailsv
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$1488, %rsp                     # imm = 0x5D0
	.cfi_def_cfa_offset 1504
	.cfi_offset %rbx, -16
	leaq	12(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipGetDevice
	callq	_Z15checkCudaErrorsv
	movl	(%rbx), %esi
	leaq	16(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipGetDevicePropertiesR0600
	callq	_Z15checkCudaErrorsv
	movl	$.L.str.6, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	360(%rbx), %esi
	movl	364(%rbx), %edx
	movl	$.L.str.7, %edi
	xorl	%eax, %eax
	callq	printf
	movl	388(%rbx), %esi
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	movl	336(%rbx), %esi
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	callq	printf
	movl	320(%rbx), %esi
	movl	$.L.str.10, %edi
	xorl	%eax, %eax
	callq	printf
	movq	288(%rbx), %rax
	testq	%rax, %rax
	js	.LBB5_1
# %bb.2:
	cvtsi2ss	%rax, %xmm0
	jmp	.LBB5_3
.LBB5_1:
	movq	%rax, %rcx
	shrq	%rcx
	andl	$1, %eax
	orq	%rcx, %rax
	cvtsi2ss	%rax, %xmm0
	addss	%xmm0, %xmm0
.LBB5_3:
	cvtss2sd	%xmm0, %xmm0
	mulsd	.LCPI5_0(%rip), %xmm0
	movl	$.L.str.11, %edi
	movb	$1, %al
	callq	printf
	movl	324(%rsp), %esi
	movl	$.L.str.12, %edi
	xorl	%eax, %eax
	callq	printf
	addq	$1488, %rsp                     # imm = 0x5D0
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z18printDeviceDetailsv, .Lfunc_end5-_Z18printDeviceDetailsv
	.cfi_endproc
                                        # -- End function
	.globl	_Z13CudaGetDevicePi             # -- Begin function _Z13CudaGetDevicePi
	.type	_Z13CudaGetDevicePi,@function
_Z13CudaGetDevicePi:                    # @_Z13CudaGetDevicePi
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	hipGetDevice
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Z15checkCudaErrorsv            # TAILCALL
.Lfunc_end6:
	.size	_Z13CudaGetDevicePi, .Lfunc_end6-_Z13CudaGetDevicePi
	.cfi_endproc
                                        # -- End function
	.globl	_Z23CudaGetDevicePropertiesP20hipDeviceProp_tR0600i # -- Begin function _Z23CudaGetDevicePropertiesP20hipDeviceProp_tR0600i
	.type	_Z23CudaGetDevicePropertiesP20hipDeviceProp_tR0600i,@function
_Z23CudaGetDevicePropertiesP20hipDeviceProp_tR0600i: # @_Z23CudaGetDevicePropertiesP20hipDeviceProp_tR0600i
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	hipGetDevicePropertiesR0600
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Z15checkCudaErrorsv            # TAILCALL
.Lfunc_end7:
	.size	_Z23CudaGetDevicePropertiesP20hipDeviceProp_tR0600i, .Lfunc_end7-_Z23CudaGetDevicePropertiesP20hipDeviceProp_tR0600i
	.cfi_endproc
                                        # -- End function
	.globl	_Z15checkCudaErrorsv            # -- Begin function _Z15checkCudaErrorsv
	.type	_Z15checkCudaErrorsv,@function
_Z15checkCudaErrorsv:                   # @_Z15checkCudaErrorsv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB8_2
# %bb.1:
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.LBB8_2:
	.cfi_def_cfa_offset 16
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.13, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	callq	hipDeviceReset
	movl	$-1, %edi
	callq	exit
.Lfunc_end8:
	.size	_Z15checkCudaErrorsv, .Lfunc_end8-_Z15checkCudaErrorsv
	.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	.LBB9_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB9_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z16simpleCopyKernelPfS_l, %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	$_Z8setArrayPffi, %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_end9:
	.size	__hip_module_ctor, .Lfunc_end9-__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	.LBB10_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
.LBB10_2:
	retq
.Lfunc_end10:
	.size	__hip_module_dtor, .Lfunc_end10-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	avgTime,@object                 # @avgTime
	.bss
	.globl	avgTime
	.p2align	4, 0x0
avgTime:
	.zero	20
	.size	avgTime, 20

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

	.type	_Z8setArrayPffi,@object         # @_Z8setArrayPffi
	.globl	_Z8setArrayPffi
	.p2align	3, 0x0
_Z8setArrayPffi:
	.quad	_Z23__device_stub__setArrayPffi
	.size	_Z8setArrayPffi, 8

	.type	_ZL9blockSize,@object           # @_ZL9blockSize
	.p2align	4, 0x0
_ZL9blockSize:
	.long	32                              # 0x20
	.long	64                              # 0x40
	.long	128                             # 0x80
	.long	256                             # 0x100
	.long	512                             # 0x200
	.size	_ZL9blockSize, 20

	.type	.L.str.3,@object                # @.str.3
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.3:
	.asciz	"Array Size = %llu\n"
	.size	.L.str.3, 19

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%3.1d%20.4f  %11.4f  \n"
	.size	.L.str.5, 23

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Device Name is %s\n"
	.size	.L.str.6, 19

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Compute Capability of this device is %d.%d\n"
	.size	.L.str.7, 44

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Number of Multiprocessors = %d\n"
	.size	.L.str.8, 32

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Max no. of blocks allowed in a 1D Grid = %d\n"
	.size	.L.str.9, 45

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Max no. of threads allowed in a block = %d\n"
	.size	.L.str.10, 44

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Total Global Memory available = %f GB\n"
	.size	.L.str.11, 39

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Warp Size in threads = %d\n"
	.size	.L.str.12, 27

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Cuda Error: %s\n"
	.size	.L.str.13, 16

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z16simpleCopyKernelPfS_l"
	.size	.L__unnamed_1, 26

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z8setArrayPffi"
	.size	.L__unnamed_2, 16

	.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	"\n"
	.size	.Lstr, 2

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"BLOCK PARTITIONING ANALYSIS"
	.size	.Lstr.2, 28

	.type	.Lstr.6,@object                 # @str.6
.Lstr.6:
	.asciz	"Block Size    Rate (GB/s)   Avg time  "
	.size	.Lstr.6, 39

	.type	.Lstr.7,@object                 # @str.7
.Lstr.7:
	.asciz	"----------------------------------------------------"
	.size	.Lstr.7, 53

	.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 _Z31__device_stub__simpleCopyKernelPfS_l
	.addrsig_sym _Z23__device_stub__setArrayPffi
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z16simpleCopyKernelPfS_l
	.addrsig_sym _Z8setArrayPffi
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z16simpleCopyKernelPfS_l ; -- Begin function _Z16simpleCopyKernelPfS_l
	.globl	_Z16simpleCopyKernelPfS_l
	.p2align	8
	.type	_Z16simpleCopyKernelPfS_l,@function
_Z16simpleCopyKernelPfS_l:              ; @_Z16simpleCopyKernelPfS_l
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x24
	s_load_b64 s[2:3], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i64_e32 vcc_lo, s[2:3], v[1:2]
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	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 _Z16simpleCopyKernelPfS_l
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.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 4
		.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	_Z16simpleCopyKernelPfS_l, .Lfunc_end0-_Z16simpleCopyKernelPfS_l
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 144
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; 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
	.protected	_Z8setArrayPffi         ; -- Begin function _Z8setArrayPffi
	.globl	_Z8setArrayPffi
	.p2align	8
	.type	_Z8setArrayPffi,@function
_Z8setArrayPffi:                        ; @_Z8setArrayPffi
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x1c
	s_load_b64 s[2:3], s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_cmp_gt_i32_e32 vcc_lo, s3, v1
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	v_mov_b32_e32 v2, s2
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z8setArrayPffi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.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 3
		.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	_Z8setArrayPffi, .Lfunc_end1-_Z8setArrayPffi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 124
; NumSgprs: 18
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 3
; 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
      - .offset:         16
        .size:           8
        .value_kind:     by_value
      - .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:           _Z16simpleCopyKernelPfS_l
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z16simpleCopyKernelPfS_l.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z8setArrayPffi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z8setArrayPffi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
