/*************************************************************************************************************
 * FILE:            lakegpu_mpi.cu
 *
 * AUTHORS:         attiffan    Aurora T. Tiffany-Davis
 *                  ssbehera    Subhendu S. Behera
 *                  wpmoore2    Wade P. Moore
 *
 * DESCRIPTION:     Assist with modeling the surface of a slice of a lake,
 *                      where some pebbles have been thrown onto the surface.
 *                  The energy level at any point on the lake is influenced by
 *                      the energy level on that point in the past,
 *                      and by the current energy levels at neighboring points.
 *                  This program takes into account all 8 neighboring points,
 *                      and parallelizes the simulation by using EXACTLY ONE compute node,
 *                      using multiple GPU threads.
 *
 * TO RUN:          srun -N4 -n4 -p opteron -x c[53,101,102] --pty /bin/bash
 *                  make -f p3.Makefile lake-mpi
 *                  prun ./lake [lake size] [# pebbles] [duration of simulation in seconds] [# GPU threads]
 *************************************************************************************************************/

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

// DEFINES
#define __DEBUG
#define TSCALE  1.0
#define VSQR    0.1

// Declare globals
double *aDeviceEnergy, *aDeviceEnergyStepOld, *aDeviceEnergyStepCurrent, *aDevicePebbleSizes;

/*************************************************************************************************************
 * FUNCTION:        kf
 *
 * DESCRIPTION:     Get the energy impact of a given pebble size on the lake based on time.
 *                  Impact decreases as time increases.
 *
 * ARGUMENTS:       nPebbleSize -   The size of a given pebble
 *                  nTime -         The amount of time that has elapsed in the simulation
 *
 * AUTHORS:         ssbehera    Subhendu S. Behera
 *************************************************************************************************************/
__device__ double kf(double nPebbleSize, double nTime)
{
  return -expf(-TSCALE * nTime) * nPebbleSize;
}

/*************************************************************************************************************
 * FUNCTION:        evolve
 *
 * DESCRIPTION:     Update the energy levels in this node's slice of the lake for every lake point therein.
 *                  Each lake point's new energy level depends upon
 *                  old energy levels and the energy levels of neighboring points.
 *                  This version uses 9 points (point of interest and 8 neighboring points).
 *                  This code runs on 1 thread and is responsible for updating the energy level of 1 lake point.
 *
 * ARGUMENTS:       aDeviceEnergy -             Array representing new energy levels at every point in the lake
 *                  aDeviceEnergyStepOld -      Array representing current energy levels at every point in the lake
 *                  aDeviceEnergyStepCurrent -  Array representing old energy levels at every point in the lake
 *                  aDevicePebbleSizes -        Array representing the pebble sizes at every point in the lake (sparse)
 *                  nTime -                     The amount of time that has elapsed in the simulation
 *                  nLakePointsOneAxis -                  Number of lake points in this node's slice of the lake, on the x axis
 *                  nPointsY -                  Number of lake points in this node's slice of the lake, on the y axis
 *                  nTimeStep -                  The amount of time between one simulation step and the next
 *                  nPointSpacing -             The spacing between two points on the lake
 *
 * RETURNS:         None
 *
 * AUTHOR:          ssbehera    Subhendu S. Behera
 *                  attiffan    Aurora T. Tiffany-Davis
 *************************************************************************************************************/
__global__ void evolve(
    double *aDeviceEnergy,
    double *aDeviceEnergyStepOld,
    double *aDeviceEnergyStepCurrent,
    double *aDevicePebbleSizes,
    double nTime,
    int nPointsX,
	int nPointsY,
    double nTimeStep,
    double nPointSpacing,
	int nMyRank,
	int nNumTaskPoints
)
{

    // Declare variables
	int nIndexInMemory;

	int idx, idy;

	// Calculate thread index
	idx = threadIdx.x + blockIdx.x * blockDim.x;
	idy = threadIdx.y + blockIdx.y * blockDim.y;

	int nLakePointsOneAxis = nPointsX;

	// If the thread is actually needed to help with the calculation
	if (idx <= nPointsX - 1 && idy <= nPointsY - 1) {
		nIndexInMemory = (idy + 1) * (nPointsX) + idx;

		if (idy == 0 && nMyRank == 0) {
			aDeviceEnergy[nIndexInMemory] = 0.;
		}
		else if (idy == nPointsY - 1 && nMyRank == 3)
			aDeviceEnergy[nIndexInMemory] = 0.;
		else if (idx == 0 || idx == nPointsX - 1)
			aDeviceEnergy[nIndexInMemory] = 0.;
		else {
        aDeviceEnergy[nIndexInMemory] =
            2 * aDeviceEnergyStepCurrent[nIndexInMemory] -
            aDeviceEnergyStepOld[nIndexInMemory] +
            VSQR * (nTimeStep * nTimeStep) * (
                (
                    aDeviceEnergyStepCurrent[nIndexInMemory - 1] +
                    aDeviceEnergyStepCurrent[nIndexInMemory + 1] +
                    aDeviceEnergyStepCurrent[nIndexInMemory + nLakePointsOneAxis] +
                    aDeviceEnergyStepCurrent[nIndexInMemory - nLakePointsOneAxis] +
                    0.25 * (
                        aDeviceEnergyStepCurrent[nIndexInMemory + nLakePointsOneAxis - 1] +
                        aDeviceEnergyStepCurrent[nIndexInMemory + nLakePointsOneAxis + 1] +
                        aDeviceEnergyStepCurrent[nIndexInMemory - nLakePointsOneAxis - 1] +
                        aDeviceEnergyStepCurrent[nIndexInMemory - nLakePointsOneAxis + 1]
                    ) -
                    5 * aDeviceEnergyStepCurrent[nIndexInMemory]
                ) /
                (nPointSpacing * nPointSpacing) +
                kf(aDevicePebbleSizes[nIndexInMemory], nTime)
            );

		}
	}

}

/*************************************************************************************************************
 * FUNCTION:        gpu_memory_setup
 *
 * DESCRIPTION:     Allocate memory used by the GPU, and copy over pebble sizes array
 *                      (which does not change during execution).
 *
 * ARGUMENTS:       nNumTaskPointsWithBoundaries -  The total number of lake points that this node cares about
 *                                                  Includes this node's own lake points,
 *                                                      plus boundaries above / north and below / south
 *                  aPebbleSizes -                  Array representing pebbles in this node's slice of the lake
 *
 * RETURNS:         None
 *
 * AUTHOR:          ssbehera    Subhendu S. Behera
 *************************************************************************************************************/
void gpu_memory_setup(int nNumTaskPointsWithBoundaries, double *aPebbleSizes)
{

	cudaMalloc((void **)&aDeviceEnergy, sizeof(double) * nNumTaskPointsWithBoundaries);
	cudaMalloc((void **)&aDeviceEnergyStepOld, sizeof(double) * nNumTaskPointsWithBoundaries);
	cudaMalloc((void **)&aDeviceEnergyStepCurrent, sizeof(double) * nNumTaskPointsWithBoundaries);
	cudaMalloc((void **)&aDevicePebbleSizes, sizeof(double) * nNumTaskPointsWithBoundaries);
}

/*************************************************************************************************************
 * FUNCTION:        gpu_memory_free
 *
 * DESCRIPTION:     Free memory allocated by the GPU
 *
 * ARGUMENTS:       None
 *
 * RETURNS:         None
 *
 * AUTHOR:          ssbehera    Subhendu S. Behera
 *************************************************************************************************************/
void gpu_memory_free(void)
{
	/*
	 * Free the device memory.
	 */
	cudaFree(aDeviceEnergy);
	cudaFree(aDeviceEnergyStepOld);
	cudaFree(aDeviceEnergyStepCurrent);
	cudaFree(aDevicePebbleSizes);
}

/*************************************************************************************************************
 * FUNCTION:        run_gpu
 *
 * DESCRIPTION:     Simulate the energy changes over time in this node's slice of the lake, on the GPU
 *
 * ARGUMENTS:       aEnergyStepOld -                Array representing energy levels at every point in the lake at the previous time step
 *                  aEnergyStepCurrent -            Array representing energy levels at every point in the lake at the current time step
 *                  nLakePointsOneAxis -            The number of points in the map of the lake (one axis)
 *                  nNumTaskPointsWithBoundaries -  The total number of lake points that this node cares about
 *                                                  Includes this node's own lake points,
 *                                                      plus boundaries above / north and below / south
 *                  nPointSpacing -                 The spacing between two points on the lake
 *                  nTime -                         The current time value within the lake simulation
 *                  nThreads -                      The number of threads to be used per axis of 2D block (if block is 2D)
 *                                                  The intention is to have the total number of threads
 *                                                  equal the total number of lake points that this node is responsible for
 *
 * RETURNS:         None
 *
 * AUTHORS:         ssbehera    Subhendu S. Behera
 *************************************************************************************************************/
void run_gpu(
    double *aEnergyStepOld,
    double *aEnergyStepCurrent,
    int nLakePointsOneAxis,
    int nNumTaskPointsWithBoundaries,
    double nPointSpacing,
    double nTime,
    int nThreads, int nMyRank,
	int nNumTasks,
	double *aPebbleSizes
)
{

    // Declare variables
    double nTimeStep;
    int nNumTaskPoints;
	int nPointsY;

	/* Calculate block dimensions
	 *  One drawback of our design decision to split up the lake in slices instead of quadrants
	 *  is that this could result in some unused threads
	 */
	int blockDimensionX = (nLakePointsOneAxis / nThreads);
	if (blockDimensionX == 0)
		blockDimensionX++;

	int blockDimensionY = nLakePointsOneAxis / nNumTasks / nThreads;
	if (blockDimensionY == 0)
		blockDimensionY++;

	dim3 threadsPerBlock(nThreads, nThreads);
	dim3 noOfBlocks(blockDimensionX, blockDimensionY);


    // Calculate time step
	nTimeStep = nPointSpacing / 2;
	
	nNumTaskPoints = nNumTaskPointsWithBoundaries - (2 * nLakePointsOneAxis);

	nPointsY = nLakePointsOneAxis / nNumTasks;


	/*
	 * copy data
	 */
	cudaMemcpy(aDeviceEnergyStepOld, aEnergyStepOld, sizeof(double) * nNumTaskPointsWithBoundaries,
			   cudaMemcpyHostToDevice);
	cudaMemcpy(aDeviceEnergyStepCurrent, aEnergyStepCurrent, sizeof(double) * nNumTaskPointsWithBoundaries,
			   cudaMemcpyHostToDevice);

 	cudaMemcpy(aDevicePebbleSizes, aPebbleSizes, sizeof(double) * nNumTaskPointsWithBoundaries,
               cudaMemcpyHostToDevice);


	/*
	 * Make the kernel call.
	 */
	//nPointsY = nNumTaskPoints / nLakePointsOneAxis;
	evolve<<<noOfBlocks, threadsPerBlock>>>(
        aDeviceEnergy,
        aDeviceEnergyStepOld,
        aDeviceEnergyStepCurrent,
        aDevicePebbleSizes,
        nTime,
        nLakePointsOneAxis,
		nPointsY,
        nTimeStep,
        nPointSpacing,
		nMyRank,
		nNumTaskPoints
    );

	/*
	 * copy the current energy to old energy as cpu is free.
	 */
	memcpy(aEnergyStepOld, aEnergyStepCurrent, sizeof(double) * nNumTaskPointsWithBoundaries);

	/*
	 * copy the new energy to current energy directly from the device.
	 */
	cudaMemcpy(aEnergyStepCurrent + nLakePointsOneAxis, aDeviceEnergy + nLakePointsOneAxis, sizeof(double) * nNumTaskPoints,
			   cudaMemcpyDeviceToHost);
}

	.file	"tmpxft_002a3781_00000000-6_lakegpu_mpi.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2033:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2033:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z2kfdd
	.type	_Z2kfdd, @function
_Z2kfdd:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2027:
	.size	_Z2kfdd, .-_Z2kfdd
	.globl	_Z16gpu_memory_setupiPd
	.type	_Z16gpu_memory_setupiPd, @function
_Z16gpu_memory_setupiPd:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movslq	%edi, %rbx
	leaq	aDeviceEnergy(%rip), %rdi
	salq	$3, %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	%rbx, %rsi
	leaq	aDeviceEnergyStepOld(%rip), %rdi
	call	cudaMalloc@PLT
	movq	%rbx, %rsi
	leaq	aDeviceEnergyStepCurrent(%rip), %rdi
	call	cudaMalloc@PLT
	movq	%rbx, %rsi
	leaq	aDevicePebbleSizes(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	cudaMalloc@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z16gpu_memory_setupiPd, .-_Z16gpu_memory_setupiPd
	.globl	_Z15gpu_memory_freev
	.type	_Z15gpu_memory_freev, @function
_Z15gpu_memory_freev:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	aDeviceEnergy(%rip), %rdi
	call	cudaFree@PLT
	movq	aDeviceEnergyStepOld(%rip), %rdi
	call	cudaFree@PLT
	movq	aDeviceEnergyStepCurrent(%rip), %rdi
	call	cudaFree@PLT
	movq	aDevicePebbleSizes(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	cudaFree@PLT
	.cfi_endproc
.LFE2029:
	.size	_Z15gpu_memory_freev, .-_Z15gpu_memory_freev
	.globl	_Z38__device_stub__Z6evolvePdS_S_S_diiddiiPdS_S_S_diiddii
	.type	_Z38__device_stub__Z6evolvePdS_S_S_diiddiiPdS_S_S_diiddii, @function
_Z38__device_stub__Z6evolvePdS_S_S_diiddiiPdS_S_S_diiddii:
.LFB2055:
	.cfi_startproc
	endbr64
	subq	$232, %rsp
	.cfi_def_cfa_offset 240
	movq	%rdi, 56(%rsp)
	leaq	80(%rsp), %rdi
	movq	%rsi, 48(%rsp)
	leaq	92(%rsp), %rsi
	movq	%rdx, 40(%rsp)
	leaq	64(%rsp), %rdx
	movq	%rcx, 32(%rsp)
	leaq	72(%rsp), %rcx
	movl	%r8d, 20(%rsp)
	movl	%r9d, 16(%rsp)
	movsd	%xmm0, 24(%rsp)
	movsd	%xmm1, 8(%rsp)
	movsd	%xmm2, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movl	$1, 88(%rsp)
	movq	%rax, 128(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 184(%rsp)
	movq	%rsp, %rax
	movq	%rax, 192(%rsp)
	leaq	240(%rsp), %rax
	movq	%rax, 200(%rsp)
	leaq	248(%rsp), %rax
	movq	%rax, 208(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movq	%rax, 92(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L8
	pushq	72(%rsp)
	.cfi_def_cfa_offset 248
	leaq	_Z6evolvePdS_S_S_diiddii(%rip), %rdi
	pushq	72(%rsp)
	.cfi_def_cfa_offset 256
	movq	108(%rsp), %rcx
	movl	116(%rsp), %r8d
	movq	96(%rsp), %rsi
	movl	104(%rsp), %edx
	leaq	144(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 248
	popq	%rdx
	.cfi_def_cfa_offset 240
.L8:
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$232, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z38__device_stub__Z6evolvePdS_S_S_diiddiiPdS_S_S_diiddii, .-_Z38__device_stub__Z6evolvePdS_S_S_diiddiiPdS_S_S_diiddii
	.globl	_Z6evolvePdS_S_S_diiddii
	.type	_Z6evolvePdS_S_S_diiddii, @function
_Z6evolvePdS_S_S_diiddii:
.LFB2056:
	.cfi_startproc
	endbr64
	jmp	_Z38__device_stub__Z6evolvePdS_S_S_diiddiiPdS_S_S_diiddii
	.cfi_endproc
.LFE2056:
	.size	_Z6evolvePdS_S_S_diiddii, .-_Z6evolvePdS_S_S_diiddii
	.globl	_Z7run_gpuPdS_iiddiiiS_
	.type	_Z7run_gpuPdS_iiddiiiS_, @function
_Z7run_gpuPdS_iiddiiiS_:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movaps	%xmm0, %xmm2
	movl	%r9d, %r15d
	movaps	%xmm1, %xmm0
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	movl	$1, %esi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movslq	%edx, %rbx
	movl	%ebx, %eax
	cltd
	idivl	%r8d
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movl	128(%rsp), %edi
	movq	136(%rsp), %r14
	testl	%eax, %eax
	je	.L15
	movl	%eax, %esi
.L15:
	movl	%ebx, %eax
	cltd
	idivl	%edi
	cltd
	movl	%eax, 12(%rsp)
	idivl	%r8d
	testl	%eax, %eax
	jne	.L16
	movl	$1, %eax
.L16:
	movl	%eax, 56(%rsp)
	movl	%ecx, %r12d
	leal	(%rbx,%rbx), %eax
	movslq	%ecx, %rcx
	movq	aDeviceEnergyStepOld(%rip), %rdi
	subl	%eax, %r12d
	movl	%esi, 52(%rsp)
	leaq	0(,%rcx,8), %rax
	movq	%rax, %rdx
	movl	$1, %ecx
	movq	%r13, %rsi
	movl	%r8d, 40(%rsp)
	movsd	%xmm0, 24(%rsp)
	movsd	%xmm2, 16(%rsp)
	movl	%r8d, 44(%rsp)
	movl	$1, 48(%rsp)
	movl	$1, 60(%rsp)
	movq	%rax, (%rsp)
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	%rbp, %rsi
	movq	aDeviceEnergyStepCurrent(%rip), %rdi
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	%r14, %rsi
	movq	aDevicePebbleSizes(%rip), %rdi
	call	cudaMemcpy@PLT
	movl	48(%rsp), %ecx
	movl	60(%rsp), %esi
	xorl	%r9d, %r9d
	movq	40(%rsp), %rdx
	movq	52(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	movsd	16(%rsp), %xmm2
	movsd	24(%rsp), %xmm0
	testl	%eax, %eax
	jne	.L17
	movsd	.LC0(%rip), %xmm1
	pushq	%r12
	.cfi_def_cfa_offset 136
	movl	%ebx, %r8d
	movq	aDeviceEnergyStepCurrent(%rip), %rdx
	movq	aDevicePebbleSizes(%rip), %rcx
	pushq	%r15
	.cfi_def_cfa_offset 144
	mulsd	%xmm2, %xmm1
	movl	28(%rsp), %r9d
	movq	aDeviceEnergyStepOld(%rip), %rsi
	movq	aDeviceEnergy(%rip), %rdi
	call	_Z38__device_stub__Z6evolvePdS_S_S_diiddiiPdS_S_S_diiddii
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L17:
	movq	(%rsp), %rcx
	movq	%r13, %rdi
	movq	%rbp, %rsi
	salq	$3, %rbx
	rep movsb
	movslq	%r12d, %rdx
	leaq	0(%rbp,%rbx), %rdi
	movl	$2, %ecx
	salq	$3, %rdx
	movq	aDeviceEnergy(%rip), %rsi
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	addq	%rbx, %rsi
	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
	jmp	cudaMemcpy@PLT
	.cfi_endproc
.LFE2030:
	.size	_Z7run_gpuPdS_iiddiiiS_, .-_Z7run_gpuPdS_iiddiiiS_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"_Z6evolvePdS_S_S_diiddii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2058:
	.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	.LC1(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z6evolvePdS_S_S_diiddii(%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
.LFE2058:
	.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	aDevicePebbleSizes
	.bss
	.align 8
	.type	aDevicePebbleSizes, @object
	.size	aDevicePebbleSizes, 8
aDevicePebbleSizes:
	.zero	8
	.globl	aDeviceEnergyStepCurrent
	.align 8
	.type	aDeviceEnergyStepCurrent, @object
	.size	aDeviceEnergyStepCurrent, 8
aDeviceEnergyStepCurrent:
	.zero	8
	.globl	aDeviceEnergyStepOld
	.align 8
	.type	aDeviceEnergyStepOld, @object
	.size	aDeviceEnergyStepOld, 8
aDeviceEnergyStepOld:
	.zero	8
	.globl	aDeviceEnergy
	.align 8
	.type	aDeviceEnergy, @object
	.size	aDeviceEnergy, 8
aDeviceEnergy:
	.zero	8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1071644672
	.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:

/*************************************************************************************************************
 * FILE:            lakegpu_mpi.cu
 *
 * AUTHORS:         attiffan    Aurora T. Tiffany-Davis
 *                  ssbehera    Subhendu S. Behera
 *                  wpmoore2    Wade P. Moore
 *
 * DESCRIPTION:     Assist with modeling the surface of a slice of a lake,
 *                      where some pebbles have been thrown onto the surface.
 *                  The energy level at any point on the lake is influenced by
 *                      the energy level on that point in the past,
 *                      and by the current energy levels at neighboring points.
 *                  This program takes into account all 8 neighboring points,
 *                      and parallelizes the simulation by using EXACTLY ONE compute node,
 *                      using multiple GPU threads.
 *
 * TO RUN:          srun -N4 -n4 -p opteron -x c[53,101,102] --pty /bin/bash
 *                  make -f p3.Makefile lake-mpi
 *                  prun ./lake [lake size] [# pebbles] [duration of simulation in seconds] [# GPU threads]
 *************************************************************************************************************/

// INCLUDES
#include <stdlib.h>
#include <stdio.h>
#include <hip/hip_runtime.h>
#include <time.h>

// DEFINES
#define __DEBUG
#define TSCALE  1.0
#define VSQR    0.1

// Declare globals
double *aDeviceEnergy, *aDeviceEnergyStepOld, *aDeviceEnergyStepCurrent, *aDevicePebbleSizes;

/*************************************************************************************************************
 * FUNCTION:        kf
 *
 * DESCRIPTION:     Get the energy impact of a given pebble size on the lake based on time.
 *                  Impact decreases as time increases.
 *
 * ARGUMENTS:       nPebbleSize -   The size of a given pebble
 *                  nTime -         The amount of time that has elapsed in the simulation
 *
 * AUTHORS:         ssbehera    Subhendu S. Behera
 *************************************************************************************************************/
__device__ double kf(double nPebbleSize, double nTime)
{
  return -expf(-TSCALE * nTime) * nPebbleSize;
}

/*************************************************************************************************************
 * FUNCTION:        evolve
 *
 * DESCRIPTION:     Update the energy levels in this node's slice of the lake for every lake point therein.
 *                  Each lake point's new energy level depends upon
 *                  old energy levels and the energy levels of neighboring points.
 *                  This version uses 9 points (point of interest and 8 neighboring points).
 *                  This code runs on 1 thread and is responsible for updating the energy level of 1 lake point.
 *
 * ARGUMENTS:       aDeviceEnergy -             Array representing new energy levels at every point in the lake
 *                  aDeviceEnergyStepOld -      Array representing current energy levels at every point in the lake
 *                  aDeviceEnergyStepCurrent -  Array representing old energy levels at every point in the lake
 *                  aDevicePebbleSizes -        Array representing the pebble sizes at every point in the lake (sparse)
 *                  nTime -                     The amount of time that has elapsed in the simulation
 *                  nLakePointsOneAxis -                  Number of lake points in this node's slice of the lake, on the x axis
 *                  nPointsY -                  Number of lake points in this node's slice of the lake, on the y axis
 *                  nTimeStep -                  The amount of time between one simulation step and the next
 *                  nPointSpacing -             The spacing between two points on the lake
 *
 * RETURNS:         None
 *
 * AUTHOR:          ssbehera    Subhendu S. Behera
 *                  attiffan    Aurora T. Tiffany-Davis
 *************************************************************************************************************/
__global__ void evolve(
    double *aDeviceEnergy,
    double *aDeviceEnergyStepOld,
    double *aDeviceEnergyStepCurrent,
    double *aDevicePebbleSizes,
    double nTime,
    int nPointsX,
	int nPointsY,
    double nTimeStep,
    double nPointSpacing,
	int nMyRank,
	int nNumTaskPoints
)
{

    // Declare variables
	int nIndexInMemory;

	int idx, idy;

	// Calculate thread index
	idx = threadIdx.x + blockIdx.x * blockDim.x;
	idy = threadIdx.y + blockIdx.y * blockDim.y;

	int nLakePointsOneAxis = nPointsX;

	// If the thread is actually needed to help with the calculation
	if (idx <= nPointsX - 1 && idy <= nPointsY - 1) {
		nIndexInMemory = (idy + 1) * (nPointsX) + idx;

		if (idy == 0 && nMyRank == 0) {
			aDeviceEnergy[nIndexInMemory] = 0.;
		}
		else if (idy == nPointsY - 1 && nMyRank == 3)
			aDeviceEnergy[nIndexInMemory] = 0.;
		else if (idx == 0 || idx == nPointsX - 1)
			aDeviceEnergy[nIndexInMemory] = 0.;
		else {
        aDeviceEnergy[nIndexInMemory] =
            2 * aDeviceEnergyStepCurrent[nIndexInMemory] -
            aDeviceEnergyStepOld[nIndexInMemory] +
            VSQR * (nTimeStep * nTimeStep) * (
                (
                    aDeviceEnergyStepCurrent[nIndexInMemory - 1] +
                    aDeviceEnergyStepCurrent[nIndexInMemory + 1] +
                    aDeviceEnergyStepCurrent[nIndexInMemory + nLakePointsOneAxis] +
                    aDeviceEnergyStepCurrent[nIndexInMemory - nLakePointsOneAxis] +
                    0.25 * (
                        aDeviceEnergyStepCurrent[nIndexInMemory + nLakePointsOneAxis - 1] +
                        aDeviceEnergyStepCurrent[nIndexInMemory + nLakePointsOneAxis + 1] +
                        aDeviceEnergyStepCurrent[nIndexInMemory - nLakePointsOneAxis - 1] +
                        aDeviceEnergyStepCurrent[nIndexInMemory - nLakePointsOneAxis + 1]
                    ) -
                    5 * aDeviceEnergyStepCurrent[nIndexInMemory]
                ) /
                (nPointSpacing * nPointSpacing) +
                kf(aDevicePebbleSizes[nIndexInMemory], nTime)
            );

		}
	}

}

/*************************************************************************************************************
 * FUNCTION:        gpu_memory_setup
 *
 * DESCRIPTION:     Allocate memory used by the GPU, and copy over pebble sizes array
 *                      (which does not change during execution).
 *
 * ARGUMENTS:       nNumTaskPointsWithBoundaries -  The total number of lake points that this node cares about
 *                                                  Includes this node's own lake points,
 *                                                      plus boundaries above / north and below / south
 *                  aPebbleSizes -                  Array representing pebbles in this node's slice of the lake
 *
 * RETURNS:         None
 *
 * AUTHOR:          ssbehera    Subhendu S. Behera
 *************************************************************************************************************/
void gpu_memory_setup(int nNumTaskPointsWithBoundaries, double *aPebbleSizes)
{

	hipMalloc((void **)&aDeviceEnergy, sizeof(double) * nNumTaskPointsWithBoundaries);
	hipMalloc((void **)&aDeviceEnergyStepOld, sizeof(double) * nNumTaskPointsWithBoundaries);
	hipMalloc((void **)&aDeviceEnergyStepCurrent, sizeof(double) * nNumTaskPointsWithBoundaries);
	hipMalloc((void **)&aDevicePebbleSizes, sizeof(double) * nNumTaskPointsWithBoundaries);
}

/*************************************************************************************************************
 * FUNCTION:        gpu_memory_free
 *
 * DESCRIPTION:     Free memory allocated by the GPU
 *
 * ARGUMENTS:       None
 *
 * RETURNS:         None
 *
 * AUTHOR:          ssbehera    Subhendu S. Behera
 *************************************************************************************************************/
void gpu_memory_free(void)
{
	/*
	 * Free the device memory.
	 */
	hipFree(aDeviceEnergy);
	hipFree(aDeviceEnergyStepOld);
	hipFree(aDeviceEnergyStepCurrent);
	hipFree(aDevicePebbleSizes);
}

/*************************************************************************************************************
 * FUNCTION:        run_gpu
 *
 * DESCRIPTION:     Simulate the energy changes over time in this node's slice of the lake, on the GPU
 *
 * ARGUMENTS:       aEnergyStepOld -                Array representing energy levels at every point in the lake at the previous time step
 *                  aEnergyStepCurrent -            Array representing energy levels at every point in the lake at the current time step
 *                  nLakePointsOneAxis -            The number of points in the map of the lake (one axis)
 *                  nNumTaskPointsWithBoundaries -  The total number of lake points that this node cares about
 *                                                  Includes this node's own lake points,
 *                                                      plus boundaries above / north and below / south
 *                  nPointSpacing -                 The spacing between two points on the lake
 *                  nTime -                         The current time value within the lake simulation
 *                  nThreads -                      The number of threads to be used per axis of 2D block (if block is 2D)
 *                                                  The intention is to have the total number of threads
 *                                                  equal the total number of lake points that this node is responsible for
 *
 * RETURNS:         None
 *
 * AUTHORS:         ssbehera    Subhendu S. Behera
 *************************************************************************************************************/
void run_gpu(
    double *aEnergyStepOld,
    double *aEnergyStepCurrent,
    int nLakePointsOneAxis,
    int nNumTaskPointsWithBoundaries,
    double nPointSpacing,
    double nTime,
    int nThreads, int nMyRank,
	int nNumTasks,
	double *aPebbleSizes
)
{

    // Declare variables
    double nTimeStep;
    int nNumTaskPoints;
	int nPointsY;

	/* Calculate block dimensions
	 *  One drawback of our design decision to split up the lake in slices instead of quadrants
	 *  is that this could result in some unused threads
	 */
	int blockDimensionX = (nLakePointsOneAxis / nThreads);
	if (blockDimensionX == 0)
		blockDimensionX++;

	int blockDimensionY = nLakePointsOneAxis / nNumTasks / nThreads;
	if (blockDimensionY == 0)
		blockDimensionY++;

	dim3 threadsPerBlock(nThreads, nThreads);
	dim3 noOfBlocks(blockDimensionX, blockDimensionY);


    // Calculate time step
	nTimeStep = nPointSpacing / 2;
	
	nNumTaskPoints = nNumTaskPointsWithBoundaries - (2 * nLakePointsOneAxis);

	nPointsY = nLakePointsOneAxis / nNumTasks;


	/*
	 * copy data
	 */
	hipMemcpy(aDeviceEnergyStepOld, aEnergyStepOld, sizeof(double) * nNumTaskPointsWithBoundaries,
			   hipMemcpyHostToDevice);
	hipMemcpy(aDeviceEnergyStepCurrent, aEnergyStepCurrent, sizeof(double) * nNumTaskPointsWithBoundaries,
			   hipMemcpyHostToDevice);

 	hipMemcpy(aDevicePebbleSizes, aPebbleSizes, sizeof(double) * nNumTaskPointsWithBoundaries,
               hipMemcpyHostToDevice);


	/*
	 * Make the kernel call.
	 */
	//nPointsY = nNumTaskPoints / nLakePointsOneAxis;
	evolve<<<noOfBlocks, threadsPerBlock>>>(
        aDeviceEnergy,
        aDeviceEnergyStepOld,
        aDeviceEnergyStepCurrent,
        aDevicePebbleSizes,
        nTime,
        nLakePointsOneAxis,
		nPointsY,
        nTimeStep,
        nPointSpacing,
		nMyRank,
		nNumTaskPoints
    );

	/*
	 * copy the current energy to old energy as cpu is free.
	 */
	memcpy(aEnergyStepOld, aEnergyStepCurrent, sizeof(double) * nNumTaskPointsWithBoundaries);

	/*
	 * copy the new energy to current energy directly from the device.
	 */
	hipMemcpy(aEnergyStepCurrent + nLakePointsOneAxis, aDeviceEnergy + nLakePointsOneAxis, sizeof(double) * nNumTaskPoints,
			   hipMemcpyDeviceToHost);
}

	.text
	.file	"lakegpu_mpi.hip"
	.globl	_Z21__device_stub__evolvePdS_S_S_diiddii # -- Begin function _Z21__device_stub__evolvePdS_S_S_diiddii
	.type	_Z21__device_stub__evolvePdS_S_S_diiddii,@function
_Z21__device_stub__evolvePdS_S_S_diiddii: # @_Z21__device_stub__evolvePdS_S_S_diiddii
	.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	$208, %rsp
	.cfi_def_cfa_offset 256
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	72(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	64(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	56(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	48(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	40(%rsp), %rcx
	movsd	%xmm0, (%rcx)
	leaq	4(%rsp), %r10
	movl	%r8d, (%r10)
	movq	%rsp, %r8
	movl	%r9d, (%r8)
	leaq	32(%rsp), %r9
	movsd	%xmm1, (%r9)
	leaq	24(%rsp), %r11
	movsd	%xmm2, (%r11)
	leaq	112(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r10, 40(%rbx)
	movq	%r8, 48(%rbx)
	movq	%r9, 56(%rbx)
	movq	%r11, 64(%rbx)
	leaq	256(%rsp), %rax
	movq	%rax, 72(%rbx)
	leaq	264(%rsp), %rax
	movq	%rax, 80(%rbx)
	leaq	96(%rsp), %r14
	leaq	80(%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	$_Z6evolvePdS_S_S_diiddii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$224, %rsp
	.cfi_adjust_cfa_offset -224
	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	_Z21__device_stub__evolvePdS_S_S_diiddii, .Lfunc_end0-_Z21__device_stub__evolvePdS_S_S_diiddii
	.cfi_endproc
                                        # -- End function
	.globl	_Z16gpu_memory_setupiPd         # -- Begin function _Z16gpu_memory_setupiPd
	.type	_Z16gpu_memory_setupiPd,@function
_Z16gpu_memory_setupiPd:                # @_Z16gpu_memory_setupiPd
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movslq	%edi, %rbx
	shlq	$3, %rbx
	movl	$aDeviceEnergy, %edi
	movq	%rbx, %rsi
	callq	hipMalloc
	movl	$aDeviceEnergyStepOld, %edi
	movq	%rbx, %rsi
	callq	hipMalloc
	movl	$aDeviceEnergyStepCurrent, %edi
	movq	%rbx, %rsi
	callq	hipMalloc
	movl	$aDevicePebbleSizes, %edi
	movq	%rbx, %rsi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	hipMalloc                       # TAILCALL
.Lfunc_end1:
	.size	_Z16gpu_memory_setupiPd, .Lfunc_end1-_Z16gpu_memory_setupiPd
	.cfi_endproc
                                        # -- End function
	.globl	_Z15gpu_memory_freev            # -- Begin function _Z15gpu_memory_freev
	.type	_Z15gpu_memory_freev,@function
_Z15gpu_memory_freev:                   # @_Z15gpu_memory_freev
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	aDeviceEnergy(%rip), %rdi
	callq	hipFree
	movq	aDeviceEnergyStepOld(%rip), %rdi
	callq	hipFree
	movq	aDeviceEnergyStepCurrent(%rip), %rdi
	callq	hipFree
	movq	aDevicePebbleSizes(%rip), %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	hipFree                         # TAILCALL
.Lfunc_end2:
	.size	_Z15gpu_memory_freev, .Lfunc_end2-_Z15gpu_memory_freev
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z7run_gpuPdS_iiddiiiS_
.LCPI3_0:
	.quad	0x3fe0000000000000              # double 0.5
	.text
	.globl	_Z7run_gpuPdS_iiddiiiS_
	.type	_Z7run_gpuPdS_iiddiiiS_,@function
_Z7run_gpuPdS_iiddiiiS_:                # @_Z7run_gpuPdS_iiddiiiS_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
                                        # kill: def $r9d killed $r9d def $r9
	movq	%r9, 32(%rsp)                   # 8-byte Spill
	movsd	%xmm1, 16(%rsp)                 # 8-byte Spill
	movsd	%xmm0, 24(%rsp)                 # 8-byte Spill
	movl	%ecx, %ebx
	movl	%edx, %r15d
	movq	%rsi, %r14
	movq	120(%rsp), %rax
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	movl	%edx, %eax
	cltd
	idivl	%r8d
	movl	%eax, %ebp
	cmpl	$1, %eax
	adcl	$0, %ebp
	movl	%r15d, %eax
	cltd
	idivl	112(%rsp)
	movl	%eax, 12(%rsp)                  # 4-byte Spill
	cltd
	idivl	%r8d
                                        # kill: def $eax killed $eax def $rax
	cmpl	$1, %eax
	adcl	$0, %eax
	movq	%rdi, %rsi
	movl	%r8d, %ecx
	movq	%rcx, %r13
	shlq	$32, %r13
	orq	%rcx, %r13
	shlq	$32, %rax
	orq	%rax, %rbp
	movq	aDeviceEnergyStepOld(%rip), %rdi
	movslq	%ebx, %r12
	subl	%r15d, %ebx
	subl	%r15d, %ebx
	shlq	$3, %r12
	movq	%rsi, 48(%rsp)                  # 8-byte Spill
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	aDeviceEnergyStepCurrent(%rip), %rdi
	movq	%r14, %rsi
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	aDevicePebbleSizes(%rip), %rdi
	movq	40(%rsp), %rsi                  # 8-byte Reload
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r13, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_2
# %bb.1:
	movsd	.LCPI3_0(%rip), %xmm1           # xmm1 = mem[0],zero
	movsd	24(%rsp), %xmm2                 # 8-byte Reload
                                        # xmm2 = mem[0],zero
	mulsd	%xmm2, %xmm1
	movq	aDeviceEnergy(%rip), %rdi
	movq	aDeviceEnergyStepOld(%rip), %rsi
	movq	aDeviceEnergyStepCurrent(%rip), %rdx
	movq	aDevicePebbleSizes(%rip), %rcx
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movl	%r15d, %r8d
	movl	12(%rsp), %r9d                  # 4-byte Reload
	pushq	%rbx
	.cfi_adjust_cfa_offset 8
	pushq	40(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	callq	_Z21__device_stub__evolvePdS_S_S_diiddii
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB3_2:
	movq	48(%rsp), %rdi                  # 8-byte Reload
	movq	%r14, %rsi
	movq	%r12, %rdx
	callq	memcpy@PLT
	movslq	%r15d, %rsi
	leaq	(%r14,%rsi,8), %rdi
	shlq	$3, %rsi
	addq	aDeviceEnergy(%rip), %rsi
	movslq	%ebx, %rdx
	shlq	$3, %rdx
	movl	$2, %ecx
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	hipMemcpy                       # TAILCALL
.Lfunc_end3:
	.size	_Z7run_gpuPdS_iiddiiiS_, .Lfunc_end3-_Z7run_gpuPdS_iiddiiiS_
	.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	$_Z6evolvePdS_S_S_diiddii, %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	aDeviceEnergy,@object           # @aDeviceEnergy
	.bss
	.globl	aDeviceEnergy
	.p2align	3, 0x0
aDeviceEnergy:
	.quad	0
	.size	aDeviceEnergy, 8

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

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

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

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

	.type	.L__unnamed_1,@object           # @0
	.section	.rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
	.asciz	"_Z6evolvePdS_S_S_diiddii"
	.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

	.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 _Z21__device_stub__evolvePdS_S_S_diiddii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym aDeviceEnergy
	.addrsig_sym aDeviceEnergyStepOld
	.addrsig_sym aDeviceEnergyStepCurrent
	.addrsig_sym aDevicePebbleSizes
	.addrsig_sym _Z6evolvePdS_S_S_diiddii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z6evolvePdS_S_S_diiddii ; -- Begin function _Z6evolvePdS_S_S_diiddii
	.globl	_Z6evolvePdS_S_S_diiddii
	.p2align	8
	.type	_Z6evolvePdS_S_S_diiddii,@function
_Z6evolvePdS_S_S_diiddii:               ; @_Z6evolvePdS_S_S_diiddii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x54
	s_load_b64 s[16:17], s[0:1], 0x28
	v_and_b32_e32 v3, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s3, s2, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[1:2], null, s14, s3, v[3:4]
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s16, v1
	s_cbranch_execz .LBB0_13
; %bb.1:
	v_bfe_u32 v0, v0, 10, 10
	s_lshr_b32 s2, s2, 16
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[4:5], null, s15, s2, v[0:1]
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s17, v4
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_13
; %bb.2:
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x40
	s_load_b64 s[12:13], s[0:1], 0x20
	s_load_b256 s[4:11], s[0:1], 0x0
	v_mul_lo_u32 v0, s16, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add3_u32 v0, v0, s16, v1
	s_waitcnt lgkmcnt(0)
	v_or_b32_e32 v2, s2, v4
	v_cmp_ne_u32_e32 vcc_lo, 0, v2
                                        ; implicit-def: $vgpr2_vgpr3
	s_and_saveexec_b32 s3, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_xor_b32 s3, exec_lo, s3
	s_cbranch_execz .LBB0_10
; %bb.3:
	s_add_i32 s14, s17, -1
	s_cmp_lg_u32 s2, 3
	v_cmp_ne_u32_e32 vcc_lo, s14, v4
	s_cselect_b32 s2, -1, 0
                                        ; implicit-def: $vgpr2_vgpr3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s2, s2, vcc_lo
	s_and_saveexec_b32 s14, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_xor_b32 s14, exec_lo, s14
	s_cbranch_execz .LBB0_7
; %bb.4:
	s_add_i32 s2, s16, -1
	v_cmp_ne_u32_e32 vcc_lo, 0, v1
	v_cmp_ne_u32_e64 s2, s2, v1
	v_mov_b32_e32 v2, 0
	v_mov_b32_e32 v3, 0
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s15, vcc_lo, s2
	s_and_saveexec_b32 s2, s15
	s_cbranch_execz .LBB0_6
; %bb.5:
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[14:15], 3, v[0:1]
	s_ashr_i32 s17, s16, 31
	v_subrev_nc_u32_e32 v10, s16, v0
	s_lshl_b64 s[18:19], s[16:17], 3
	v_add_co_u32 v2, vcc_lo, s8, v14
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v15, vcc_lo
	v_ashrrev_i32_e32 v11, 31, v10
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v6, vcc_lo, v2, s18
	v_add_co_ci_u32_e32 v7, vcc_lo, s19, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_3)
	v_lshlrev_b64 v[10:11], 3, v[10:11]
	s_clause 0x3
	global_load_b64 v[16:17], v[2:3], off offset:8
	global_load_b128 v[2:5], v[2:3], off offset:-8
	global_load_b64 v[18:19], v[6:7], off offset:8
	global_load_b128 v[6:9], v[6:7], off offset:-8
	s_load_b128 s[16:19], s[0:1], 0x30
	s_mov_b32 s0, 0x9999999a
	s_mov_b32 s1, 0x3fb99999
	v_add_co_u32 v20, vcc_lo, s8, v10
	v_add_co_ci_u32_e32 v21, vcc_lo, s9, v11, vcc_lo
	s_clause 0x1
	global_load_b128 v[10:13], v[20:21], off offset:-8
	global_load_b64 v[20:21], v[20:21], off offset:8
	s_waitcnt vmcnt(4)
	v_add_f64 v[2:3], v[2:3], v[16:17]
	s_waitcnt vmcnt(2)
	v_add_f64 v[6:7], v[6:7], v[18:19]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_f64 v[2:3], v[2:3], v[8:9]
	s_waitcnt vmcnt(1)
	v_add_f64 v[6:7], v[6:7], v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_add_f64 v[2:3], v[2:3], v[12:13]
	v_add_co_u32 v12, vcc_lo, s6, v14
	s_waitcnt vmcnt(0)
	v_add_f64 v[6:7], v[6:7], v[20:21]
	v_add_co_ci_u32_e32 v13, vcc_lo, s7, v15, vcc_lo
	v_add_co_u32 v14, vcc_lo, s10, v14
	v_add_co_ci_u32_e32 v15, vcc_lo, s11, v15, vcc_lo
	global_load_b64 v[12:13], v[12:13], off
	global_load_b64 v[14:15], v[14:15], off
	v_cvt_f32_f64_e64 v20, -s[12:13]
	v_fma_f64 v[2:3], 0x3fd00000, v[6:7], v[2:3]
	s_waitcnt lgkmcnt(0)
	v_mul_f64 v[6:7], s[18:19], s[18:19]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[2:3], 0xc0140000, v[4:5], v[2:3]
	v_div_scale_f64 v[8:9], null, v[6:7], v[6:7], v[2:3]
	v_div_scale_f64 v[18:19], vcc_lo, v[2:3], v[6:7], v[2:3]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[10:11], v[8:9]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[16:17], -v[8:9], v[10:11], 1.0
	v_fma_f64 v[10:11], v[10:11], v[16:17], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], -v[8:9], v[10:11], 1.0
	v_fma_f64 v[10:11], v[10:11], v[16:17], v[10:11]
	s_waitcnt vmcnt(1)
	v_fma_f64 v[4:5], v[4:5], 2.0, -v[12:13]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[16:17], v[18:19], v[10:11]
	v_fma_f64 v[8:9], -v[8:9], v[16:17], v[18:19]
	v_mul_f32_e32 v18, 0x3fb8aa3b, v20
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_fma_f32 v19, 0x3fb8aa3b, v20, -v18
	v_rndne_f32_e32 v21, v18
	v_div_fmas_f64 v[8:9], v[8:9], v[10:11], v[16:17]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_dual_fmamk_f32 v10, v20, 0x32a5705f, v19 :: v_dual_sub_f32 v11, v18, v21
	v_cmp_ngt_f32_e32 vcc_lo, 0xc2ce8ed0, v20
	v_add_f32_e32 v10, v11, v10
	v_cvt_i32_f32_e32 v11, v21
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_exp_f32_e32 v10, v10
	s_waitcnt_depctr 0xfff
	v_ldexp_f32 v10, v10, v11
	v_cndmask_b32_e32 v10, 0, v10, vcc_lo
	v_cmp_nlt_f32_e32 vcc_lo, 0x42b17218, v20
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v16, 0x7f800000, v10, vcc_lo
	v_mul_f64 v[10:11], s[16:17], s[16:17]
	v_div_fixup_f64 v[2:3], v[8:9], v[6:7], v[2:3]
	v_cvt_f64_f32_e32 v[6:7], v16
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_f64 v[8:9], v[10:11], s[0:1]
	s_waitcnt vmcnt(0)
	v_fma_f64 v[2:3], -v[14:15], v[6:7], v[2:3]
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[2:3], v[8:9], v[2:3], v[4:5]
.LBB0_6:                                ; %Flow
	s_or_b32 exec_lo, exec_lo, s2
.LBB0_7:                                ; %Flow103
	s_and_not1_saveexec_b32 s0, s14
; %bb.8:
	v_mov_b32_e32 v2, 0
	v_mov_b32_e32 v3, 0
	v_ashrrev_i32_e32 v1, 31, v0
; %bb.9:                                ; %Flow104
	s_or_b32 exec_lo, exec_lo, s0
.LBB0_10:                               ; %Flow105
	s_and_not1_saveexec_b32 s0, s3
; %bb.11:
	v_mov_b32_e32 v2, 0
	v_mov_b32_e32 v3, 0
	v_ashrrev_i32_e32 v1, 31, v0
; %bb.12:                               ; %.sink.split
	s_or_b32 exec_lo, exec_lo, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 3, v[0:1]
	v_add_co_u32 v0, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_store_b64 v[0:1], v[2:3], off
.LBB0_13:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6evolvePdS_S_S_diiddii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 328
		.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 22
		.amdhsa_next_free_sgpr 20
		.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	_Z6evolvePdS_S_S_diiddii, .Lfunc_end0-_Z6evolvePdS_S_S_diiddii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 952
; NumSgprs: 22
; NumVgprs: 22
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 22
; NumVGPRsForWavesPerEU: 22
; 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
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           8
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     by_value
      - .offset:         44
        .size:           4
        .value_kind:     by_value
      - .offset:         48
        .size:           8
        .value_kind:     by_value
      - .offset:         56
        .size:           8
        .value_kind:     by_value
      - .offset:         64
        .size:           4
        .value_kind:     by_value
      - .offset:         68
        .size:           4
        .value_kind:     by_value
      - .offset:         72
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         76
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         80
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         84
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         86
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         88
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         90
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         92
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         94
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         120
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         136
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 328
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z6evolvePdS_S_S_diiddii
    .private_segment_fixed_size: 0
    .sgpr_count:     22
    .sgpr_spill_count: 0
    .symbol:         _Z6evolvePdS_S_S_diiddii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     22
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
