/*******************************************
*
*  Program for 2D/3D array allocations of CUDA
*  a   :zhonghy
*  date:2018-4-16
*
********************************************/

//#include "cuda.h"
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "device_functions.h"

#include <stdio.h>
#include <iostream>

//access type of global variables 
__constant__ float constData[256];
__device__ float devData;
__device__ float *devPointer;


//Device code, access for 2D array, will be padded
//pitch is actual size of row after padded? inerval across each rows
__global__ void MyKernel2D(float *devPtr, size_t pitch, int width, int height)
{
	for(int r = 0; r < height; r++)
	{
		float *row = (float*)((char*)devPtr + pitch); //first pointer of row
			for(int c = 0; c < width; c++)
			{
				float element = row[c];
			}
	}
}

//Device code, access for 3D array, will be padded
__global__ void MyKernel3D(cudaPitchedPtr devPitchedPtr,
	                       int width, int height, int depth)
{
	char *devPtr = (char *)devPitchedPtr.ptr;   //add type transfrom?
	size_t pitch = devPitchedPtr.pitch;
	size_t slicePitch = pitch * height;
	for(int z = 0; z < depth; ++z)
	{
		float *slice = (float*)(devPtr + z * slicePitch);
		for(int y = 0; y < height; ++y)
		{
			float *row = (float*)(devPtr + y * pitch); //poir to calucate first pointer
			for(int x = 0; x < width; ++x)
			{
				float element = row[x];
			}
		}
	}
}

int main(int argc, char *argv[])
{
	//CUDA allocate width x height 2D array
	int width = 64, height = 64;
	float *devPtr;
	size_t pitch;
	cudaMallocPitch(&devPtr, &pitch,    //cudaMallocPitch()
		width * sizeof(float), height);

	MyKernel2D<<<100, 512>>>(devPtr, pitch, width, height);
	
	std::cout << "pitch of 2D array: " << pitch << std::endl;
	std::cout << "width of 2D array is :" << width << std::endl;

	cudaFree(devPtr);


	//CUDA allocate witdth x height x depth 3D array
	int depth = 64;
	cudaExtent extent = make_cudaExtent(width * sizeof(float), height, depth);
	cudaPitchedPtr devPitchedPtr;
	cudaMalloc3D(&devPitchedPtr, extent);

	MyKernel3D<<<100, 512>>>(devPitchedPtr, width, height, depth);

	std::cout << std::endl;
	std::cout << "pitch of 2D array: " << devPitchedPtr.pitch << std::endl;
	std::cout << "width of 2D array is :" << devPitchedPtr.xsize << std::endl;
	std::cout << "y of 2D array is :" << devPitchedPtr.ysize << std::endl;

	cudaFree(devPitchedPtr.ptr);



	//access type of global variables 
	//__constant__ float constData[256];
	float data[256];
	cudaMemcpyToSymbol(constData, data, sizeof(data));
	cudaMemcpyFromSymbol(data, constData, sizeof(data));

	//__device__ float devData;
	float value = 3.14f;
	cudaMemcpyToSymbol(&devData, &value, sizeof(float)); //wrong in document

	//__device__ float *devPointer;
	float *ptr;
	cudaMalloc(&ptr, 256 * sizeof(float));
	cudaMemcpyToSymbol(devPointer, ptr, sizeof(ptr));  //it is like reference?

	return 0;
}
	.file	"tmpxft_00373581_00000000-6_cuda_PitchMemAllocate.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3638:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3638:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4301:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4301:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.globl	_Z33__device_stub__Z10MyKernel2DPfmiiPfmii
	.type	_Z33__device_stub__Z10MyKernel2DPfmiiPfmii, @function
_Z33__device_stub__Z10MyKernel2DPfmiiPfmii:
.LFB3660:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L3
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z10MyKernel2DPfmii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L3:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3660:
	.size	_Z33__device_stub__Z10MyKernel2DPfmiiPfmii, .-_Z33__device_stub__Z10MyKernel2DPfmiiPfmii
	.globl	_Z10MyKernel2DPfmii
	.type	_Z10MyKernel2DPfmii, @function
_Z10MyKernel2DPfmii:
.LFB3661:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z10MyKernel2DPfmiiPfmii
	.cfi_endproc
.LFE3661:
	.size	_Z10MyKernel2DPfmii, .-_Z10MyKernel2DPfmii
	.globl	_Z47__device_stub__Z10MyKernel3D14cudaPitchedPtriiiR14cudaPitchedPtriii
	.type	_Z47__device_stub__Z10MyKernel3D14cudaPitchedPtriiiR14cudaPitchedPtriii, @function
_Z47__device_stub__Z10MyKernel3D14cudaPitchedPtriiiR14cudaPitchedPtriii:
.LFB3662:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movl	%esi, 12(%rsp)
	leaq	52(%rsp), %rsi
	movl	%edx, 8(%rsp)
	leaq	24(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	32(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rax
	movq	%rdi, 88(%rsp)
	leaq	40(%rsp), %rdi
	movq	%rax, 96(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movl	$1, 48(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L9
	pushq	32(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z10MyKernel3D14cudaPitchedPtriii(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 160
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L9:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3662:
	.size	_Z47__device_stub__Z10MyKernel3D14cudaPitchedPtriiiR14cudaPitchedPtriii, .-_Z47__device_stub__Z10MyKernel3D14cudaPitchedPtriiiR14cudaPitchedPtriii
	.globl	_Z10MyKernel3D14cudaPitchedPtriii
	.type	_Z10MyKernel3D14cudaPitchedPtriii, @function
_Z10MyKernel3D14cudaPitchedPtriii:
.LFB3663:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	%edx, %ecx
	movl	%esi, %edx
	movl	%edi, %esi
	leaq	16(%rsp), %rdi
	call	_Z47__device_stub__Z10MyKernel3D14cudaPitchedPtriiiR14cudaPitchedPtriii
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3663:
	.size	_Z10MyKernel3D14cudaPitchedPtriii, .-_Z10MyKernel3D14cudaPitchedPtriii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"pitch of 2D array: "
.LC1:
	.string	"width of 2D array is :"
.LC2:
	.string	"y of 2D array is :"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3635:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$64, %ecx
	movl	$256, %edx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$1176, %rsp
	.cfi_def_cfa_offset 1216
	movq	%fs:40, %rax
	movq	%rax, 1160(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	leaq	8(%rsp), %rdi
	call	cudaMallocPitch@PLT
	movl	$8388609, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1073741849, %edi
	salq	$9, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	salq	$2, %rdi
	movq	%rdx, 104(%rsp)
	movl	$1, 112(%rsp)
	movq	%rdi, 72(%rsp)
	movl	$1, 80(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L16
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$64, %ecx
	movl	$64, %edx
	call	_Z33__device_stub__Z10MyKernel2DPfmiiPfmii
.L16:
	leaq	_ZSt4cout(%rip), %rbx
	leaq	.LC0(%rip), %r13
	movq	%r13, %rsi
	movq	%rbx, %rdi
	leaq	.LC1(%rip), %r12
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	16(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	%r12, %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$64, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	leaq	72(%rsp), %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 1248
	movq	$256, 80(%rsp)
	movq	$64, 88(%rsp)
	movups	80(%rsp), %xmm0
	movq	$64, 16(%rsp)
	movups	%xmm0, (%rsp)
	call	cudaMalloc3D@PLT
	movl	$8388609, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$9, %rdx
	movl	$1073741849, %edi
	movl	$1, %ecx
	movl	$1, 76(%rsp)
	movq	%rdx, 68(%rsp)
	salq	$2, %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 1216
	movl	$1, %esi
	call	__cudaPushCallConfiguration@PLT
	leaq	104(%rsp), %rbp
	testl	%eax, %eax
	jne	.L17
	movups	72(%rsp), %xmm1
	movups	88(%rsp), %xmm2
	movl	$64, %ecx
	movq	%rbp, %rdi
	movl	$64, %edx
	movl	$64, %esi
	movups	%xmm1, 104(%rsp)
	movups	%xmm2, 120(%rsp)
	call	_Z47__device_stub__Z10MyKernel3D14cudaPitchedPtriiiR14cudaPitchedPtriii
.L17:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	%rbx, %rdi
	movq	%r13, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	80(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	%r12, %rsi
	movq	%rbx, %rdi
	leaq	_ZL9constData(%rip), %r12
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	88(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	%rbx, %rdi
	leaq	.LC2(%rip), %rsi
	leaq	136(%rsp), %rbx
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	96(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	xorl	%ecx, %ecx
	movl	$1, %r8d
	movq	%rbx, %rsi
	movl	$1024, %edx
	movq	%r12, %rdi
	call	cudaMemcpyToSymbol@PLT
	xorl	%ecx, %ecx
	movl	$2, %r8d
	movq	%r12, %rsi
	movl	$1024, %edx
	movq	%rbx, %rdi
	call	cudaMemcpyFromSymbol@PLT
	xorl	%ecx, %ecx
	movl	$1, %r8d
	movq	%rbp, %rdi
	movl	$4, %edx
	leaq	_ZL7devData(%rip), %rax
	leaq	36(%rsp), %rsi
	movl	$0x4048f5c3, 36(%rsp)
	movq	%rax, 104(%rsp)
	call	cudaMemcpyToSymbol@PLT
	movl	$1024, %esi
	movq	%rbp, %rdi
	call	cudaMalloc@PLT
	movq	104(%rsp), %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	movl	$8, %edx
	leaq	_ZL10devPointer(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movq	1160(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$1176, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3635:
	.size	main, .-main
	.section	.rodata.str1.1
.LC4:
	.string	"_Z10MyKernel3D14cudaPitchedPtriii"
.LC5:
	.string	"_Z10MyKernel2DPfmii"
.LC6:
	.string	"constData"
.LC7:
	.string	"devData"
.LC8:
	.string	"devPointer"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3665:
	.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	.LC4(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z10MyKernel3D14cudaPitchedPtriii(%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	.LC5(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z10MyKernel2DPfmii(%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
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC6(%rip), %rdx
	movl	$1024, %r9d
	leaq	_ZL9constData(%rip), %rsi
	pushq	$1
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC7(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL7devData(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC8(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movl	$8, %r9d
	movq	%rdx, %rcx
	leaq	_ZL10devPointer(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%r8
	.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
.LFE3665:
	.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
	.local	_ZL10devPointer
	.comm	_ZL10devPointer,8,8
	.local	_ZL7devData
	.comm	_ZL7devData,4,4
	.local	_ZL9constData
	.comm	_ZL9constData,1024,32
	.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:

/*******************************************
*
*  Program for 2D/3D array allocations of CUDA
*  a   :zhonghy
*  date:2018-4-16
*
********************************************/

//#include "cuda.h"
#include "hip/hip_runtime.h"

#include "hip/device_functions.h"

#include <stdio.h>
#include <iostream>

//access type of global variables 
__constant__ float constData[256];
__device__ float devData;
__device__ float *devPointer;


//Device code, access for 2D array, will be padded
//pitch is actual size of row after padded? inerval across each rows
__global__ void MyKernel2D(float *devPtr, size_t pitch, int width, int height)
{
	for(int r = 0; r < height; r++)
	{
		float *row = (float*)((char*)devPtr + pitch); //first pointer of row
			for(int c = 0; c < width; c++)
			{
				float element = row[c];
			}
	}
}

//Device code, access for 3D array, will be padded
__global__ void MyKernel3D(hipPitchedPtr devPitchedPtr,
	                       int width, int height, int depth)
{
	char *devPtr = (char *)devPitchedPtr.ptr;   //add type transfrom?
	size_t pitch = devPitchedPtr.pitch;
	size_t slicePitch = pitch * height;
	for(int z = 0; z < depth; ++z)
	{
		float *slice = (float*)(devPtr + z * slicePitch);
		for(int y = 0; y < height; ++y)
		{
			float *row = (float*)(devPtr + y * pitch); //poir to calucate first pointer
			for(int x = 0; x < width; ++x)
			{
				float element = row[x];
			}
		}
	}
}

int main(int argc, char *argv[])
{
	//CUDA allocate width x height 2D array
	int width = 64, height = 64;
	float *devPtr;
	size_t pitch;
	hipMallocPitch(&devPtr, &pitch,    //cudaMallocPitch()
		width * sizeof(float), height);

	MyKernel2D<<<100, 512>>>(devPtr, pitch, width, height);
	
	std::cout << "pitch of 2D array: " << pitch << std::endl;
	std::cout << "width of 2D array is :" << width << std::endl;

	hipFree(devPtr);


	//CUDA allocate witdth x height x depth 3D array
	int depth = 64;
	hipExtent extent = make_hipExtent(width * sizeof(float), height, depth);
	hipPitchedPtr devPitchedPtr;
	hipMalloc3D(&devPitchedPtr, extent);

	MyKernel3D<<<100, 512>>>(devPitchedPtr, width, height, depth);

	std::cout << std::endl;
	std::cout << "pitch of 2D array: " << devPitchedPtr.pitch << std::endl;
	std::cout << "width of 2D array is :" << devPitchedPtr.xsize << std::endl;
	std::cout << "y of 2D array is :" << devPitchedPtr.ysize << std::endl;

	hipFree(devPitchedPtr.ptr);



	//access type of global variables 
	//__constant__ float constData[256];
	float data[256];
	hipMemcpyToSymbol(HIP_SYMBOL(constData), data, sizeof(data));
	hipMemcpyFromSymbol(data, HIP_SYMBOL(constData), sizeof(data));

	//__device__ float devData;
	float value = 3.14f;
	hipMemcpyToSymbol(HIP_SYMBOL(&devData), &value, sizeof(float)); //wrong in document

	//__device__ float *devPointer;
	float *ptr;
	hipMalloc(&ptr, 256 * sizeof(float));
	hipMemcpyToSymbol(HIP_SYMBOL(devPointer), ptr, sizeof(ptr));  //it is like reference?

	return 0;
}
	.text
	.file	"cuda_PitchMemAllocate.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z25__device_stub__MyKernel2DPfmii # -- Begin function _Z25__device_stub__MyKernel2DPfmii
	.type	_Z25__device_stub__MyKernel2DPfmii,@function
_Z25__device_stub__MyKernel2DPfmii:     # @_Z25__device_stub__MyKernel2DPfmii
	.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), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%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	$_Z10MyKernel2DPfmii, %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	_Z25__device_stub__MyKernel2DPfmii, .Lfunc_end0-_Z25__device_stub__MyKernel2DPfmii
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__MyKernel3D13hipPitchedPtriii # -- Begin function _Z25__device_stub__MyKernel3D13hipPitchedPtriii
	.type	_Z25__device_stub__MyKernel3D13hipPitchedPtriii,@function
_Z25__device_stub__MyKernel3D13hipPitchedPtriii: # @_Z25__device_stub__MyKernel3D13hipPitchedPtriii
	.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	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	8(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	4(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	144(%rsp), %rdx
	leaq	64(%rsp), %rbx
	movq	%rdx, (%rbx)
	movq	%rax, 8(%rbx)
	movq	%rcx, 16(%rbx)
	movq	%rsi, 24(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%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	$_Z10MyKernel3D13hipPitchedPtriii, %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	_Z25__device_stub__MyKernel3D13hipPitchedPtriii, .Lfunc_end1-_Z25__device_stub__MyKernel3D13hipPitchedPtriii
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.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	$1152, %rsp                     # imm = 0x480
	.cfi_def_cfa_offset 1200
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movabsq	$4294967396, %rbx               # imm = 0x100000064
	leaq	48(%rsp), %rdi
	leaq	40(%rsp), %rsi
	movl	$64, %r13d
	movl	$256, %edx                      # imm = 0x100
	movl	$64, %ecx
	callq	hipMallocPitch
	leaq	412(%rbx), %r14
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_2
# %bb.1:
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rsi
	movl	$64, %edx
	movl	$64, %ecx
	callq	_Z25__device_stub__MyKernel2DPfmii
.LBB2_2:
	movl	$_ZSt4cout, %r12d
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	40(%rsp), %rsi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r15
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$22, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$64, %esi
	callq	_ZNSolsEi
	movq	%rax, %r15
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	$256, 104(%rsp)                 # imm = 0x100
	movq	%r13, 112(%rsp)
	movq	%r13, 120(%rsp)
	movq	%r13, 16(%rsp)
	movups	104(%rsp), %xmm0
	movups	%xmm0, (%rsp)
	leaq	72(%rsp), %rdi
	callq	hipMalloc3D
	movq	%rbx, %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:
	movups	72(%rsp), %xmm0
	movups	88(%rsp), %xmm1
	movups	%xmm1, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$64, %edi
	movl	$64, %esi
	movl	$64, %edx
	callq	_Z25__device_stub__MyKernel3D13hipPitchedPtriii
.LBB2_4:
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	80(%rsp), %rsi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$22, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	88(%rsp), %rsi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$18, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	96(%rsp), %rsi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	72(%rsp), %rdi
	callq	hipFree
	leaq	128(%rsp), %rbx
	movl	$constData, %edi
	movl	$1024, %edx                     # imm = 0x400
	movq	%rbx, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movl	$constData, %esi
	movl	$1024, %edx                     # imm = 0x400
	movq	%rbx, %rdi
	xorl	%ecx, %ecx
	movl	$2, %r8d
	callq	hipMemcpyFromSymbol
	leaq	68(%rsp), %rsi
	movl	$1078523331, (%rsi)             # imm = 0x4048F5C3
	leaq	56(%rsp), %rdi
	movq	$devData, (%rdi)
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	leaq	56(%rsp), %rbx
	movl	$1024, %esi                     # imm = 0x400
	movq	%rbx, %rdi
	callq	hipMalloc
	movq	(%rbx), %rsi
	movl	$devPointer, %edi
	movl	$8, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	xorl	%eax, %eax
	addq	$1152, %rsp                     # imm = 0x480
	.cfi_def_cfa_offset 48
	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_end2:
	.size	main, .Lfunc_end2-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB3_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB3_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10MyKernel2DPfmii, %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	$_Z10MyKernel3D13hipPitchedPtriii, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$0, 8(%rsp)
	movl	$1, (%rsp)
	movl	$constData, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movl	$1024, %r9d                     # imm = 0x400
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$0, 8(%rsp)
	movl	$0, (%rsp)
	movl	$devData, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$0, 8(%rsp)
	movl	$0, (%rsp)
	movl	$devPointer, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movl	$8, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	callq	__hipRegisterVar
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end3:
	.size	__hip_module_ctor, .Lfunc_end3-__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	.LBB4_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
.LBB4_2:
	retq
.Lfunc_end4:
	.size	__hip_module_dtor, .Lfunc_end4-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	constData,@object               # @constData
	.local	constData
	.comm	constData,1024,16
	.type	devData,@object                 # @devData
	.local	devData
	.comm	devData,4,4
	.type	devPointer,@object              # @devPointer
	.local	devPointer
	.comm	devPointer,8,8
	.type	_Z10MyKernel2DPfmii,@object     # @_Z10MyKernel2DPfmii
	.section	.rodata,"a",@progbits
	.globl	_Z10MyKernel2DPfmii
	.p2align	3, 0x0
_Z10MyKernel2DPfmii:
	.quad	_Z25__device_stub__MyKernel2DPfmii
	.size	_Z10MyKernel2DPfmii, 8

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"pitch of 2D array: "
	.size	.L.str, 20

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"width of 2D array is :"
	.size	.L.str.1, 23

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"y of 2D array is :"
	.size	.L.str.2, 19

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z10MyKernel2DPfmii"
	.size	.L__unnamed_1, 20

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z10MyKernel3D13hipPitchedPtriii"
	.size	.L__unnamed_2, 33

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"constData"
	.size	.L__unnamed_3, 10

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"devData"
	.size	.L__unnamed_4, 8

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"devPointer"
	.size	.L__unnamed_5, 11

	.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 _Z25__device_stub__MyKernel2DPfmii
	.addrsig_sym _Z25__device_stub__MyKernel3D13hipPitchedPtriii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym constData
	.addrsig_sym devData
	.addrsig_sym devPointer
	.addrsig_sym _Z10MyKernel2DPfmii
	.addrsig_sym _Z10MyKernel3D13hipPitchedPtriii
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z10MyKernel2DPfmii     ; -- Begin function _Z10MyKernel2DPfmii
	.globl	_Z10MyKernel2DPfmii
	.p2align	8
	.type	_Z10MyKernel2DPfmii,@function
_Z10MyKernel2DPfmii:                    ; @_Z10MyKernel2DPfmii
; %bb.0:                                ; %._crit_edge
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10MyKernel2DPfmii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 24
		.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 1
		.amdhsa_next_free_sgpr 1
		.amdhsa_reserve_vcc 0
		.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	_Z10MyKernel2DPfmii, .Lfunc_end0-_Z10MyKernel2DPfmii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 4
; NumSgprs: 0
; NumVgprs: 0
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 1
; NumVGPRsForWavesPerEU: 1
; 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	_Z10MyKernel3D13hipPitchedPtriii ; -- Begin function _Z10MyKernel3D13hipPitchedPtriii
	.globl	_Z10MyKernel3D13hipPitchedPtriii
	.p2align	8
	.type	_Z10MyKernel3D13hipPitchedPtriii,@function
_Z10MyKernel3D13hipPitchedPtriii:       ; @_Z10MyKernel3D13hipPitchedPtriii
; %bb.0:                                ; %._crit_edge23
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10MyKernel3D13hipPitchedPtriii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 44
		.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 1
		.amdhsa_next_free_sgpr 1
		.amdhsa_reserve_vcc 0
		.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	_Z10MyKernel3D13hipPitchedPtriii, .Lfunc_end1-_Z10MyKernel3D13hipPitchedPtriii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 4
; NumSgprs: 0
; NumVgprs: 0
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 1
; NumVGPRsForWavesPerEU: 1
; 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
	.protected	constData               ; @constData
	.type	constData,@object
	.section	.bss,"aw",@nobits
	.globl	constData
	.p2align	4, 0x0
constData:
	.zero	1024
	.size	constData, 1024

	.protected	devData                 ; @devData
	.type	devData,@object
	.globl	devData
	.p2align	2, 0x0
devData:
	.long	0x00000000                      ; float 0
	.size	devData, 4

	.protected	devPointer              ; @devPointer
	.type	devPointer,@object
	.globl	devPointer
	.p2align	3, 0x0
devPointer:
	.quad	0
	.size	devPointer, 8

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.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 constData
	.addrsig_sym devData
	.addrsig_sym devPointer
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           8
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 24
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10MyKernel2DPfmii
    .private_segment_fixed_size: 0
    .sgpr_count:     0
    .sgpr_spill_count: 0
    .symbol:         _Z10MyKernel2DPfmii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     0
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           32
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 44
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10MyKernel3D13hipPitchedPtriii
    .private_segment_fixed_size: 0
    .sgpr_count:     0
    .sgpr_spill_count: 0
    .symbol:         _Z10MyKernel3D13hipPitchedPtriii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     0
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
