//programma calcolo prod scalare tra 2 vettori

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

using namespace std;
//input: n size vettori, n blocchi, nthread per blocco (NB: in questo esempio non si mappa 1 cella array input con un thread)
//questo esercizio usa il paradigma gather (ogni thread di un blocco calcola una sua porzione di array, vedi slide)
__host__
void inizializza(int *a,int n){
	for(int i=0;i<n;i++)
		a[i]=1+rand()%10;
}

__host__
void stampa(int *a,int n){
	
	cout<<endl<<"-------------------"<<endl;
	for(int i=0;i<n;i++)
		cout<<a[i]<<" ";
	cout<<endl;
}

__host__
void prodScalareCPU(int *a,int *b,unsigned long long int *c,int n){
	for(int i=0;i<n;i++){
		c[i]=a[i]*b[i];
		c[i]+= ((i>0) ? c[i-1] : 0);
	}
}

__global__
void prodScalareGPUNOSH(int *a,int *b,unsigned long long int *c,int n){
	
	int nThreadsGriglia = gridDim.x * blockDim.x; //numero di blocchi per numero di thread nel blocco, è proprio il numero di thread totali in griglia
	int stridePerThread = n / nThreadsGriglia; //il numero di elementi di competenza di ogni singolo thread
	int idOnGriglia = blockIdx.x * blockDim.x + threadIdx.x;
	c[idOnGriglia] = 0;
	for(int i=0;i<stridePerThread;i++){
		if(idOnGriglia * stridePerThread + i < n)
			c[idOnGriglia]+= a[idOnGriglia * stridePerThread + i] * b[idOnGriglia * stridePerThread + i];
		else break;
	}

}

__global__
void prodScalareGPUSH (int *a,int *b,unsigned long long int *c,int n){
	extern __shared__ int buffer[]; //questo viene allocato (nella chiamata kernel) per un totale del numero di threads NEL blocco
	int totThreadsInGriglia = gridDim.x * blockDim.x;
	int strideThread = n / totThreadsInGriglia; 
	int idOnGrid = blockDim.x * blockIdx.x + threadIdx.x;
	
	buffer[threadIdx.x]=0;
	
	for(int i=0;i<strideThread;i++){
		if(idOnGrid*strideThread + i < n)
			buffer[threadIdx.x]+= a[idOnGrid * strideThread +i] * b[idOnGrid * strideThread + i];
		else break;
	}
	__syncthreads();
	

	if(threadIdx.x == 0){
		c[blockIdx.x]=0;
		for(int i=0;i<blockDim.x;i++)
			c[blockIdx.x]+=buffer[i];
	}
}


int main(int argc,char **argv){
	srand((unsigned int)time(NULL));
	dim3 sizeGriglia,sizeBlocco;
	int n;
	float time1,time2;
	cudaEvent_t start1,stop1,start2,stop2;
	cudaEventCreate(&start1);
	cudaEventCreate(&start2);
	cudaEventCreate(&stop1);
	cudaEventCreate(&stop2);
	
	
	if(argc!=4){
		n=10;
		sizeGriglia.x=1;
		sizeBlocco.x=2; //2 threads per blocco, 1 blocco in totale, 10 elementi, 2 threads totali, 5 elementi calcolati per ogni thread
	}
	else{
		sscanf(argv[1],"%d",&n);
		sscanf(argv[2],"%d",&sizeGriglia.x);
		sscanf(argv[3],"%d",&sizeBlocco.x);
		//avrà sizeGriglia.x * sizeBlocco.x threads totali = threads tot.
		//avrà n/threads tot elementi per thread 
	}
	
	int *ha,*hb;
	unsigned long long int *hc;
	ha=new int[n];
	hb=new int[n];
	hc=new unsigned long long int[n]();
	inizializza(ha,n);
	inizializza(hb,n);
	//stampa(ha,n);
	//stampa(hb,n);
	cudaEventRecord(start1,0);
	prodScalareCPU(ha,hb,hc,n);
	cudaEventRecord(stop1,0);
	cudaEventSynchronize(stop1);
	cudaEventElapsedTime(&time1,start1,stop1);
	
	cout<<"il prod scalare (calcolato on cpu): "<<hc[n-1]<<" , tempo: "<<time1<<endl;
	
	//per calcolo su gpu no shared memory (vedi slide)
	int *da,*db;
	unsigned long long int *dc;
	cudaMalloc(&da,n*sizeof(int));
	cudaMalloc(&db,n*sizeof(int));
	int totThreads = sizeGriglia.x * sizeBlocco.x;
	cudaMalloc(&dc,sizeof(unsigned long long int) * totThreads);
	cudaMemcpy(da,ha,n*sizeof(int),cudaMemcpyHostToDevice);
	cudaMemcpy(db,hb,n*sizeof(int),cudaMemcpyHostToDevice);
	prodScalareGPUNOSH<<<sizeGriglia,sizeBlocco>>>(da,db,dc,n);
	cudaThreadSynchronize();
	unsigned long long int *copy = new unsigned long long int[totThreads];
	cudaMemcpy(copy,dc,totThreads * sizeof(unsigned long long int),cudaMemcpyDeviceToHost);
	unsigned long long int finalResult=0;
	
	
	for(int i=0;i<totThreads;i++)
		finalResult+=copy[i];
	cout<<"prod scalare calcolato on gpu senza shared memory: "<<finalResult<<endl;
	
	unsigned long long int *dc2;
	cudaMalloc(&dc2,sizeGriglia.x*sizeof(unsigned long long int)); //1 elemento per ogni blocco
	cudaEventRecord(start2,0);
	prodScalareGPUSH<<<sizeGriglia,sizeBlocco,sizeof(unsigned long long int)*sizeBlocco.x>>>(da,db,dc2,n);
	cudaThreadSynchronize();
	
	unsigned long long int *copy2 = new unsigned long long int[sizeGriglia.x];
	cudaMemcpy(copy2,dc2,sizeGriglia.x * sizeof(unsigned long long int),cudaMemcpyDeviceToHost);
	finalResult=0;
	//stampa(copy2,sizeGriglia.x);
	for(int i=0;i<sizeGriglia.x;i++)
		finalResult+=copy2[i];
	cudaEventRecord(stop2,0);
	cudaEventSynchronize(stop2);
	cudaEventElapsedTime(&time2,start2,stop2);
	
	cout<<"prod scalare calcolato su gpu con shared memory "<<finalResult<<" , tempo: "<<time2<<endl;
	
	
	
	delete[] ha;
	delete[] hc;
	delete[] hb;
	delete[] copy;
	cudaFree(db); 
	cudaFree(da);
	cudaFree(dc);
	cudaEventDestroy(start1);
	cudaEventDestroy(start2);
	cudaEventDestroy(stop1);
	cudaEventDestroy(stop2);

}
	.file	"tmpxft_002317cb_00000000-6_prod_scalare.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3641:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3641:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z11inizializzaPii
	.type	_Z11inizializzaPii, @function
_Z11inizializzaPii:
.LFB3635:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$10, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	pushq	%rdx
	.cfi_def_cfa_offset 48
.L3:
	cmpl	%ebx, %ebp
	jle	.L7
	call	rand@PLT
	cltd
	idivl	%r13d
	incl	%edx
	movl	%edx, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L3
.L7:
	popq	%rax
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3635:
	.size	_Z11inizializzaPii, .-_Z11inizializzaPii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"-------------------"
.LC1:
	.string	" "
	.text
	.globl	_Z6stampaPii
	.type	_Z6stampaPii, @function
_Z6stampaPii:
.LFB3636:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movl	%esi, %r12d
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	_ZSt4cout(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	xorl	%ebx, %ebx
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
.L9:
	cmpl	%ebx, %r12d
	jle	.L12
	movl	0(%r13,%rbx,4), %esi
	movq	%rbp, %rdi
	incq	%rbx
	call	_ZNSolsEi@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L9
.L12:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 40
	movq	%rbp, %rdi
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSolsEPFRSoS_E@PLT
	.cfi_endproc
.LFE3636:
	.size	_Z6stampaPii, .-_Z6stampaPii
	.globl	_Z14prodScalareCPUPiS_Pyi
	.type	_Z14prodScalareCPUPiS_Pyi, @function
_Z14prodScalareCPUPiS_Pyi:
.LFB3637:
	.cfi_startproc
	endbr64
	movq	%rdi, %r8
	xorl	%eax, %eax
.L14:
	cmpl	%eax, %ecx
	jle	.L18
	movl	(%r8,%rax,4), %edi
	imull	(%rsi,%rax,4), %edi
	xorl	%r9d, %r9d
	movslq	%edi, %rdi
	testq	%rax, %rax
	je	.L15
	movq	-8(%rdx,%rax,8), %r9
.L15:
	addq	%r9, %rdi
	movq	%rdi, (%rdx,%rax,8)
	incq	%rax
	jmp	.L14
.L18:
	ret
	.cfi_endproc
.LFE3637:
	.size	_Z14prodScalareCPUPiS_Pyi, .-_Z14prodScalareCPUPiS_Pyi
	.globl	_Z43__device_stub__Z18prodScalareGPUNOSHPiS_PyiPiS_Pyi
	.type	_Z43__device_stub__Z18prodScalareGPUNOSHPiS_PyiPiS_Pyi, @function
_Z43__device_stub__Z18prodScalareGPUNOSHPiS_PyiPiS_Pyi:
.LFB3663:
	.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
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%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	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%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	.L19
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z18prodScalareGPUNOSHPiS_Pyi(%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
.L19:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3663:
	.size	_Z43__device_stub__Z18prodScalareGPUNOSHPiS_PyiPiS_Pyi, .-_Z43__device_stub__Z18prodScalareGPUNOSHPiS_PyiPiS_Pyi
	.globl	_Z18prodScalareGPUNOSHPiS_Pyi
	.type	_Z18prodScalareGPUNOSHPiS_Pyi, @function
_Z18prodScalareGPUNOSHPiS_Pyi:
.LFB3664:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z18prodScalareGPUNOSHPiS_PyiPiS_Pyi
	.cfi_endproc
.LFE3664:
	.size	_Z18prodScalareGPUNOSHPiS_Pyi, .-_Z18prodScalareGPUNOSHPiS_Pyi
	.globl	_Z41__device_stub__Z16prodScalareGPUSHPiS_PyiPiS_Pyi
	.type	_Z41__device_stub__Z16prodScalareGPUSHPiS_PyiPiS_Pyi, @function
_Z41__device_stub__Z16prodScalareGPUSHPiS_PyiPiS_Pyi:
.LFB3665:
	.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
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%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	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%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	.L24
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z16prodScalareGPUSHPiS_Pyi(%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
.L24:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3665:
	.size	_Z41__device_stub__Z16prodScalareGPUSHPiS_PyiPiS_Pyi, .-_Z41__device_stub__Z16prodScalareGPUSHPiS_PyiPiS_Pyi
	.globl	_Z16prodScalareGPUSHPiS_Pyi
	.type	_Z16prodScalareGPUSHPiS_Pyi, @function
_Z16prodScalareGPUSHPiS_Pyi:
.LFB3666:
	.cfi_startproc
	endbr64
	jmp	_Z41__device_stub__Z16prodScalareGPUSHPiS_PyiPiS_Pyi
	.cfi_endproc
.LFE3666:
	.size	_Z16prodScalareGPUSHPiS_Pyi, .-_Z16prodScalareGPUSHPiS_Pyi
	.section	.rodata.str1.1
.LC2:
	.string	"%d"
.LC3:
	.string	"il prod scalare (calcolato on cpu): "
.LC4:
	.string	" , tempo: "
.LC5:
	.string	"prod scalare calcolato on gpu senza shared memory: "
.LC6:
	.string	"prod scalare calcolato su gpu con shared memory "
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3638:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edi, %ebp
	xorl	%edi, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
	leaq	32(%rsp), %rdi
	movabsq	$4294967297, %rax
	movl	$1, 104(%rsp)
	movq	%rax, 96(%rsp)
	movq	%rax, 108(%rsp)
	movl	$1, 116(%rsp)
	call	cudaEventCreate@PLT
	leaq	48(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	40(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	56(%rsp), %rdi
	call	cudaEventCreate@PLT
	cmpl	$4, %ebp
	je	.L30
	movl	$10, 20(%rsp)
	movl	$1, 96(%rsp)
	movl	$2, 108(%rsp)
	jmp	.L31
.L30:
	leaq	.LC2(%rip), %rbp
	movq	8(%rbx), %rdi
	leaq	20(%rsp), %rdx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	call	__isoc23_sscanf@PLT
	movq	16(%rbx), %rdi
	leaq	96(%rsp), %rdx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	call	__isoc23_sscanf@PLT
	movq	24(%rbx), %rdi
	leaq	108(%rsp), %rdx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	call	__isoc23_sscanf@PLT
.L31:
	movabsq	$2305843009213693950, %rbx
	movslq	20(%rsp), %rdi
	cmpq	%rdi, %rbx
	jb	.L32
	salq	$2, %rdi
	call	_Znam@PLT
	movslq	20(%rsp), %rdi
	movq	%rax, (%rsp)
	cmpq	%rdi, %rbx
	jnb	.L33
.L32:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L45
	call	__cxa_throw_bad_array_new_length@PLT
.L33:
	salq	$2, %rdi
	call	_Znam@PLT
	movslq	20(%rsp), %rbp
	movq	%rax, 8(%rsp)
	movabsq	$1152921504606846975, %rax
	cmpq	%rbp, %rax
	jb	.L32
	leaq	0(,%rbp,8), %rdi
	call	_Znam@PLT
	movq	%rax, %rbx
	xorl	%eax, %eax
.L35:
	cmpq	%rax, %rbp
	je	.L46
	xorl	%edx, %edx
	movq	%rdx, (%rbx,%rax,8)
	incq	%rax
	jmp	.L35
.L46:
	movl	20(%rsp), %esi
	movq	(%rsp), %rdi
	leaq	_ZSt4cout(%rip), %r13
	leaq	.LC4(%rip), %r15
	call	_Z11inizializzaPii
	movl	20(%rsp), %esi
	movq	8(%rsp), %rdi
	call	_Z11inizializzaPii
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	20(%rsp), %ecx
	movq	(%rsp), %rdi
	movq	%rbx, %rdx
	movq	8(%rsp), %rsi
	call	_Z14prodScalareCPUPiS_Pyi
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	40(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	leaq	24(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC3(%rip), %rsi
	movq	%r13, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movslq	20(%rsp), %rax
	movq	-8(%rbx,%rax,8), %rsi
	call	_ZNSo9_M_insertIyEERSoT_@PLT
	movq	%r15, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	24(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movslq	20(%rsp), %rsi
	leaq	64(%rsp), %rdi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	movslq	20(%rsp), %rsi
	leaq	72(%rsp), %rdi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	movl	96(%rsp), %r12d
	imull	108(%rsp), %r12d
	leaq	80(%rsp), %rdi
	movslq	%r12d, %rbp
	leaq	0(,%rbp,8), %r14
	movq	%r14, %rsi
	call	cudaMalloc@PLT
	movslq	20(%rsp), %rdx
	movq	(%rsp), %rsi
	movl	$1, %ecx
	movq	64(%rsp), %rdi
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movslq	20(%rsp), %rdx
	movq	8(%rsp), %rsi
	movl	$1, %ecx
	movq	72(%rsp), %rdi
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movl	116(%rsp), %ecx
	movl	104(%rsp), %esi
	xorl	%r9d, %r9d
	movq	108(%rsp), %rdx
	movq	96(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L37
	movl	20(%rsp), %ecx
	movq	80(%rsp), %rdx
	movq	72(%rsp), %rsi
	movq	64(%rsp), %rdi
	call	_Z43__device_stub__Z18prodScalareGPUNOSHPiS_PyiPiS_Pyi
.L37:
	call	cudaThreadSynchronize@PLT
	movabsq	$1152921504606846975, %rax
	cmpq	%rbp, %rax
	jb	.L32
	movq	%r14, %rdi
	call	_Znam@PLT
	movq	80(%rsp), %rsi
	movq	%r14, %rdx
	movl	$2, %ecx
	movq	%rax, %rdi
	movq	%rax, %rbp
	xorl	%r14d, %r14d
	call	cudaMemcpy@PLT
	xorl	%eax, %eax
.L38:
	cmpl	%eax, %r12d
	jle	.L47
	addq	0(%rbp,%rax,8), %r14
	incq	%rax
	jmp	.L38
.L47:
	leaq	.LC5(%rip), %rsi
	movq	%r13, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIyEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movl	96(%rsp), %esi
	leaq	88(%rsp), %rdi
	salq	$3, %rsi
	call	cudaMalloc@PLT
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	108(%rsp), %eax
	movl	116(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	108(%rsp), %rdx
	movq	96(%rsp), %rdi
	movl	104(%rsp), %esi
	leaq	0(,%rax,8), %r8
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L40
	movl	20(%rsp), %ecx
	movq	88(%rsp), %rdx
	movq	72(%rsp), %rsi
	movq	64(%rsp), %rdi
	call	_Z41__device_stub__Z16prodScalareGPUSHPiS_PyiPiS_Pyi
.L40:
	call	cudaThreadSynchronize@PLT
	movl	96(%rsp), %edi
	xorl	%r14d, %r14d
	salq	$3, %rdi
	call	_Znam@PLT
	movl	96(%rsp), %edx
	movq	88(%rsp), %rsi
	movl	$2, %ecx
	movq	%rax, %rdi
	movq	%rax, %r12
	salq	$3, %rdx
	call	cudaMemcpy@PLT
	movl	96(%rsp), %edx
	xorl	%eax, %eax
.L41:
	cmpl	%edx, %eax
	jnb	.L48
	addq	(%r12,%rax,8), %r14
	incq	%rax
	jmp	.L41
.L48:
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	leaq	28(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC6(%rip), %rsi
	movq	%r13, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIyEERSoT_@PLT
	movq	%r15, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	28(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movq	(%rsp), %rdi
	call	_ZdaPv@PLT
	movq	%rbx, %rdi
	call	_ZdaPv@PLT
	movq	8(%rsp), %rdi
	call	_ZdaPv@PLT
	movq	%rbp, %rdi
	call	_ZdaPv@PLT
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	48(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	40(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	56(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L43
.L45:
	call	__stack_chk_fail@PLT
.L43:
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3638:
	.size	main, .-main
	.section	.rodata.str1.1
.LC7:
	.string	"_Z16prodScalareGPUSHPiS_Pyi"
.LC8:
	.string	"_Z18prodScalareGPUNOSHPiS_Pyi"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3668:
	.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	.LC7(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z16prodScalareGPUSHPiS_Pyi(%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	.LC8(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z18prodScalareGPUNOSHPiS_Pyi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3668:
	.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
	.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:

//programma calcolo prod scalare tra 2 vettori

#include <hip/hip_runtime.h>
#include <stdio.h>
#include <iostream>
#include <time.h>

using namespace std;
//input: n size vettori, n blocchi, nthread per blocco (NB: in questo esempio non si mappa 1 cella array input con un thread)
//questo esercizio usa il paradigma gather (ogni thread di un blocco calcola una sua porzione di array, vedi slide)
__host__
void inizializza(int *a,int n){
	for(int i=0;i<n;i++)
		a[i]=1+rand()%10;
}

__host__
void stampa(int *a,int n){
	
	cout<<endl<<"-------------------"<<endl;
	for(int i=0;i<n;i++)
		cout<<a[i]<<" ";
	cout<<endl;
}

__host__
void prodScalareCPU(int *a,int *b,unsigned long long int *c,int n){
	for(int i=0;i<n;i++){
		c[i]=a[i]*b[i];
		c[i]+= ((i>0) ? c[i-1] : 0);
	}
}

__global__
void prodScalareGPUNOSH(int *a,int *b,unsigned long long int *c,int n){
	
	int nThreadsGriglia = gridDim.x * blockDim.x; //numero di blocchi per numero di thread nel blocco, è proprio il numero di thread totali in griglia
	int stridePerThread = n / nThreadsGriglia; //il numero di elementi di competenza di ogni singolo thread
	int idOnGriglia = blockIdx.x * blockDim.x + threadIdx.x;
	c[idOnGriglia] = 0;
	for(int i=0;i<stridePerThread;i++){
		if(idOnGriglia * stridePerThread + i < n)
			c[idOnGriglia]+= a[idOnGriglia * stridePerThread + i] * b[idOnGriglia * stridePerThread + i];
		else break;
	}

}

__global__
void prodScalareGPUSH (int *a,int *b,unsigned long long int *c,int n){
	extern __shared__ int buffer[]; //questo viene allocato (nella chiamata kernel) per un totale del numero di threads NEL blocco
	int totThreadsInGriglia = gridDim.x * blockDim.x;
	int strideThread = n / totThreadsInGriglia; 
	int idOnGrid = blockDim.x * blockIdx.x + threadIdx.x;
	
	buffer[threadIdx.x]=0;
	
	for(int i=0;i<strideThread;i++){
		if(idOnGrid*strideThread + i < n)
			buffer[threadIdx.x]+= a[idOnGrid * strideThread +i] * b[idOnGrid * strideThread + i];
		else break;
	}
	__syncthreads();
	

	if(threadIdx.x == 0){
		c[blockIdx.x]=0;
		for(int i=0;i<blockDim.x;i++)
			c[blockIdx.x]+=buffer[i];
	}
}


int main(int argc,char **argv){
	srand((unsigned int)time(NULL));
	dim3 sizeGriglia,sizeBlocco;
	int n;
	float time1,time2;
	hipEvent_t start1,stop1,start2,stop2;
	hipEventCreate(&start1);
	hipEventCreate(&start2);
	hipEventCreate(&stop1);
	hipEventCreate(&stop2);
	
	
	if(argc!=4){
		n=10;
		sizeGriglia.x=1;
		sizeBlocco.x=2; //2 threads per blocco, 1 blocco in totale, 10 elementi, 2 threads totali, 5 elementi calcolati per ogni thread
	}
	else{
		sscanf(argv[1],"%d",&n);
		sscanf(argv[2],"%d",&sizeGriglia.x);
		sscanf(argv[3],"%d",&sizeBlocco.x);
		//avrà sizeGriglia.x * sizeBlocco.x threads totali = threads tot.
		//avrà n/threads tot elementi per thread 
	}
	
	int *ha,*hb;
	unsigned long long int *hc;
	ha=new int[n];
	hb=new int[n];
	hc=new unsigned long long int[n]();
	inizializza(ha,n);
	inizializza(hb,n);
	//stampa(ha,n);
	//stampa(hb,n);
	hipEventRecord(start1,0);
	prodScalareCPU(ha,hb,hc,n);
	hipEventRecord(stop1,0);
	hipEventSynchronize(stop1);
	hipEventElapsedTime(&time1,start1,stop1);
	
	cout<<"il prod scalare (calcolato on cpu): "<<hc[n-1]<<" , tempo: "<<time1<<endl;
	
	//per calcolo su gpu no shared memory (vedi slide)
	int *da,*db;
	unsigned long long int *dc;
	hipMalloc(&da,n*sizeof(int));
	hipMalloc(&db,n*sizeof(int));
	int totThreads = sizeGriglia.x * sizeBlocco.x;
	hipMalloc(&dc,sizeof(unsigned long long int) * totThreads);
	hipMemcpy(da,ha,n*sizeof(int),hipMemcpyHostToDevice);
	hipMemcpy(db,hb,n*sizeof(int),hipMemcpyHostToDevice);
	prodScalareGPUNOSH<<<sizeGriglia,sizeBlocco>>>(da,db,dc,n);
	hipDeviceSynchronize();
	unsigned long long int *copy = new unsigned long long int[totThreads];
	hipMemcpy(copy,dc,totThreads * sizeof(unsigned long long int),hipMemcpyDeviceToHost);
	unsigned long long int finalResult=0;
	
	
	for(int i=0;i<totThreads;i++)
		finalResult+=copy[i];
	cout<<"prod scalare calcolato on gpu senza shared memory: "<<finalResult<<endl;
	
	unsigned long long int *dc2;
	hipMalloc(&dc2,sizeGriglia.x*sizeof(unsigned long long int)); //1 elemento per ogni blocco
	hipEventRecord(start2,0);
	prodScalareGPUSH<<<sizeGriglia,sizeBlocco,sizeof(unsigned long long int)*sizeBlocco.x>>>(da,db,dc2,n);
	hipDeviceSynchronize();
	
	unsigned long long int *copy2 = new unsigned long long int[sizeGriglia.x];
	hipMemcpy(copy2,dc2,sizeGriglia.x * sizeof(unsigned long long int),hipMemcpyDeviceToHost);
	finalResult=0;
	//stampa(copy2,sizeGriglia.x);
	for(int i=0;i<sizeGriglia.x;i++)
		finalResult+=copy2[i];
	hipEventRecord(stop2,0);
	hipEventSynchronize(stop2);
	hipEventElapsedTime(&time2,start2,stop2);
	
	cout<<"prod scalare calcolato su gpu con shared memory "<<finalResult<<" , tempo: "<<time2<<endl;
	
	
	
	delete[] ha;
	delete[] hc;
	delete[] hb;
	delete[] copy;
	hipFree(db); 
	hipFree(da);
	hipFree(dc);
	hipEventDestroy(start1);
	hipEventDestroy(start2);
	hipEventDestroy(stop1);
	hipEventDestroy(stop2);

}
	.text
	.file	"prod_scalare.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z11inizializzaPii              # -- Begin function _Z11inizializzaPii
	.type	_Z11inizializzaPii,@function
_Z11inizializzaPii:                     # @_Z11inizializzaPii
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB0_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	%esi, %r14d
	xorl	%r15d, %r15d
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1717986919, %rax, %rcx         # imm = 0x66666667
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$34, %rcx
	addl	%edx, %ecx
	addl	%ecx, %ecx
	leal	(%rcx,%rcx,4), %ecx
	negl	%ecx
	addl	%ecx, %eax
	incl	%eax
	movl	%eax, (%rbx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB0_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB0_4:                                # %._crit_edge
	retq
.Lfunc_end0:
	.size	_Z11inizializzaPii, .Lfunc_end0-_Z11inizializzaPii
	.cfi_endproc
                                        # -- End function
	.globl	_Z6stampaPii                    # -- Begin function _Z6stampaPii
	.type	_Z6stampaPii,@function
_Z6stampaPii:                           # @_Z6stampaPii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebp
	movq	%rdi, %rbx
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %r15d
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %r14
	movl	$.L.str, %esi
	movl	$19, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	testl	%ebp, %ebp
	jle	.LBB1_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %r14d
	xorl	%r12d, %r12d
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rbx,%r12,4), %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	incq	%r12
	cmpq	%r12, %r14
	jne	.LBB1_2
.LBB1_3:                                # %._crit_edge
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_ZNSo5flushEv                   # TAILCALL
.Lfunc_end1:
	.size	_Z6stampaPii, .Lfunc_end1-_Z6stampaPii
	.cfi_endproc
                                        # -- End function
	.globl	_Z14prodScalareCPUPiS_Pyi       # -- Begin function _Z14prodScalareCPUPiS_Pyi
	.type	_Z14prodScalareCPUPiS_Pyi,@function
_Z14prodScalareCPUPiS_Pyi:              # @_Z14prodScalareCPUPiS_Pyi
	.cfi_startproc
# %bb.0:
	testl	%ecx, %ecx
	jle	.LBB2_6
# %bb.1:                                # %.lr.ph.preheader
	movl	%ecx, %eax
	xorl	%ecx, %ecx
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	testq	%rcx, %rcx
	je	.LBB2_3
# %bb.4:                                #   in Loop: Header=BB2_2 Depth=1
	movq	-8(%rdx,%rcx,8), %r8
	jmp	.LBB2_5
.LBB2_3:                                #   in Loop: Header=BB2_2 Depth=1
	xorl	%r8d, %r8d
.LBB2_5:                                #   in Loop: Header=BB2_2 Depth=1
	movslq	(%rdi,%rcx,4), %r9
	movslq	(%rsi,%rcx,4), %r10
	imulq	%r9, %r10
	addq	%r8, %r10
	movq	%r10, (%rdx,%rcx,8)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB2_2
.LBB2_6:                                # %._crit_edge
	retq
.Lfunc_end2:
	.size	_Z14prodScalareCPUPiS_Pyi, .Lfunc_end2-_Z14prodScalareCPUPiS_Pyi
	.cfi_endproc
                                        # -- End function
	.globl	_Z33__device_stub__prodScalareGPUNOSHPiS_Pyi # -- Begin function _Z33__device_stub__prodScalareGPUNOSHPiS_Pyi
	.type	_Z33__device_stub__prodScalareGPUNOSHPiS_Pyi,@function
_Z33__device_stub__prodScalareGPUNOSHPiS_Pyi: # @_Z33__device_stub__prodScalareGPUNOSHPiS_Pyi
	.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	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%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	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	$_Z18prodScalareGPUNOSHPiS_Pyi, %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_end3:
	.size	_Z33__device_stub__prodScalareGPUNOSHPiS_Pyi, .Lfunc_end3-_Z33__device_stub__prodScalareGPUNOSHPiS_Pyi
	.cfi_endproc
                                        # -- End function
	.globl	_Z31__device_stub__prodScalareGPUSHPiS_Pyi # -- Begin function _Z31__device_stub__prodScalareGPUSHPiS_Pyi
	.type	_Z31__device_stub__prodScalareGPUSHPiS_Pyi,@function
_Z31__device_stub__prodScalareGPUSHPiS_Pyi: # @_Z31__device_stub__prodScalareGPUSHPiS_Pyi
	.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	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%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	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	$_Z16prodScalareGPUSHPiS_Pyi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z31__device_stub__prodScalareGPUSHPiS_Pyi, .Lfunc_end4-_Z31__device_stub__prodScalareGPUSHPiS_Pyi
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	movl	%edi, %ebp
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	movabsq	$4294967297, %rax               # imm = 0x100000001
	movq	%rax, 16(%rsp)
	movl	$1, %ecx
	movl	%ecx, 24(%rsp)
	movq	%rax, 32(%rsp)
	movl	%ecx, 40(%rsp)
	leaq	96(%rsp), %rdi
	callq	hipEventCreate
	leaq	88(%rsp), %rdi
	callq	hipEventCreate
	leaq	64(%rsp), %rdi
	callq	hipEventCreate
	leaq	56(%rsp), %rdi
	callq	hipEventCreate
	cmpl	$4, %ebp
	jne	.LBB5_1
# %bb.2:
	movq	8(%rbx), %rdi
	leaq	12(%rsp), %r14
	movl	$.L.str.2, %esi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movq	16(%rbx), %rdi
	leaq	16(%rsp), %rdx
	movl	$.L.str.2, %esi
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movq	24(%rbx), %rdi
	leaq	32(%rsp), %rdx
	movl	$.L.str.2, %esi
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movl	(%r14), %ebp
	jmp	.LBB5_3
.LBB5_1:
	movl	$10, 12(%rsp)
	movl	$1, 16(%rsp)
	movl	$2, 32(%rsp)
	movl	$10, %ebp
.LBB5_3:
	movslq	%ebp, %r13
	leaq	(,%r13,4), %rbx
	testl	%r13d, %r13d
	movq	$-1, %rax
	cmovsq	%rax, %rbx
	leaq	(,%r13,8), %r12
	cmovsq	%rax, %r12
	movq	%rbx, %rdi
	callq	_Znam
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_Znam
	movq	%rax, %rbx
	movq	%r12, %rdi
	callq	_Znam
	movq	%rax, %r15
	movq	%rax, %rdi
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	memset@PLT
	testl	%r13d, %r13d
	jle	.LBB5_9
# %bb.4:                                # %.lr.ph.preheader.i
	movl	%ebp, %r12d
	xorl	%r13d, %r13d
.LBB5_5:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1717986919, %rax, %rcx         # imm = 0x66666667
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$34, %rcx
	addl	%edx, %ecx
	addl	%ecx, %ecx
	leal	(%rcx,%rcx,4), %ecx
	negl	%ecx
	addl	%ecx, %eax
	incl	%eax
	movl	%eax, (%r14,%r13,4)
	incq	%r13
	cmpq	%r13, %r12
	jne	.LBB5_5
# %bb.6:                                # %_Z11inizializzaPii.exit
	movl	12(%rsp), %r12d
	testl	%r12d, %r12d
	jle	.LBB5_9
# %bb.7:                                # %.lr.ph.preheader.i52
	xorl	%r13d, %r13d
.LBB5_8:                                # %.lr.ph.i54
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$1717986919, %rax, %rcx         # imm = 0x66666667
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$34, %rcx
	addl	%edx, %ecx
	addl	%ecx, %ecx
	leal	(%rcx,%rcx,4), %ecx
	negl	%ecx
	addl	%ecx, %eax
	incl	%eax
	movl	%eax, (%rbx,%r13,4)
	incq	%r13
	cmpq	%r13, %r12
	jne	.LBB5_8
.LBB5_9:                                # %_Z11inizializzaPii.exit58
	movq	96(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.LBB5_15
# %bb.10:                               # %.lr.ph.preheader.i59
	xorl	%ecx, %ecx
.LBB5_11:                               # %.lr.ph.i61
                                        # =>This Inner Loop Header: Depth=1
	testq	%rcx, %rcx
	je	.LBB5_12
# %bb.13:                               #   in Loop: Header=BB5_11 Depth=1
	movq	-8(%r15,%rcx,8), %rdx
	jmp	.LBB5_14
.LBB5_12:                               #   in Loop: Header=BB5_11 Depth=1
	xorl	%edx, %edx
.LBB5_14:                               #   in Loop: Header=BB5_11 Depth=1
	movslq	(%r14,%rcx,4), %rsi
	movslq	(%rbx,%rcx,4), %rdi
	imulq	%rsi, %rdi
	addq	%rdx, %rdi
	movq	%rdi, (%r15,%rcx,8)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB5_11
.LBB5_15:                               # %_Z14prodScalareCPUPiS_Pyi.exit
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	64(%rsp), %rdi
	callq	hipEventSynchronize
	movq	96(%rsp), %rsi
	movq	64(%rsp), %rdx
	leaq	116(%rsp), %r12
	movq	%r12, %rdi
	callq	hipEventElapsedTime
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$36, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movslq	12(%rsp), %rax
	movq	-8(%r15,%rax,8), %rsi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIyEERSoT_
	movq	%rax, %r13
	movl	$.L.str.4, %esi
	movl	$10, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	cvtss2sd	(%r12), %xmm0
	movq	%r13, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r12
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movslq	12(%rsp), %rsi
	shlq	$2, %rsi
	leaq	80(%rsp), %r12
	movq	%r12, %rdi
	callq	hipMalloc
	movslq	12(%rsp), %rsi
	shlq	$2, %rsi
	leaq	48(%rsp), %rdi
	callq	hipMalloc
	movl	32(%rsp), %ebp
	imull	16(%rsp), %ebp
	movslq	%ebp, %r13
	shlq	$3, %r13
	leaq	72(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movq	(%r12), %rdi
	movslq	12(%rsp), %rdx
	shlq	$2, %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	48(%rsp), %rax
	movq	(%rax), %rdi
	movslq	12(%rsp), %rdx
	shlq	$2, %rdx
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	movq	32(%rsp), %rdx
	movl	40(%rsp), %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_17
# %bb.16:
	movq	80(%rsp), %rdi
	movq	48(%rsp), %rsi
	movq	72(%rsp), %rdx
	movl	12(%rsp), %ecx
	callq	_Z33__device_stub__prodScalareGPUNOSHPiS_Pyi
.LBB5_17:
	callq	hipDeviceSynchronize
	testl	%ebp, %ebp
	movq	$-1, %rdi
	cmovnsq	%r13, %rdi
	callq	_Znam
	movq	%rax, %r12
	movq	72(%rsp), %rsi
	movq	%rax, %rdi
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%ebp, %ebp
	jle	.LBB5_18
# %bb.23:                               # %.lr.ph.preheader
	movl	%ebp, %eax
	xorl	%ecx, %ecx
	xorl	%r13d, %r13d
.LBB5_24:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	addq	(%r12,%rcx,8), %r13
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB5_24
	jmp	.LBB5_19
.LBB5_18:
	xorl	%r13d, %r13d
.LBB5_19:                               # %._crit_edge
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$51, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movq	%r13, %rsi
	callq	_ZNSo9_M_insertIyEERSoT_
	movq	%rax, %r13
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	16(%rsp), %esi
	shlq	$3, %rsi
	leaq	104(%rsp), %rdi
	callq	hipMalloc
	movq	88(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	movq	32(%rsp), %rdx
	movl	40(%rsp), %ecx
	movl	%edx, %r8d
	shlq	$3, %r8
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB5_21
# %bb.20:
	movq	80(%rsp), %rdi
	movq	48(%rsp), %rsi
	movq	104(%rsp), %rdx
	movl	12(%rsp), %ecx
	callq	_Z31__device_stub__prodScalareGPUSHPiS_Pyi
.LBB5_21:
	callq	hipDeviceSynchronize
	movl	16(%rsp), %r13d
	shlq	$3, %r13
	movq	%r13, %rdi
	callq	_Znam
	movq	%rax, %rbp
	movq	104(%rsp), %rsi
	movq	%rax, %rdi
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	16(%rsp), %eax
	testq	%rax, %rax
	je	.LBB5_22
# %bb.25:                               # %.lr.ph70.preheader
	xorl	%ecx, %ecx
	xorl	%r13d, %r13d
.LBB5_26:                               # %.lr.ph70
                                        # =>This Inner Loop Header: Depth=1
	addq	(%rbp,%rcx,8), %r13
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB5_26
	jmp	.LBB5_27
.LBB5_22:
	xorl	%r13d, %r13d
.LBB5_27:                               # %._crit_edge71
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	56(%rsp), %rdi
	callq	hipEventSynchronize
	movq	88(%rsp), %rsi
	movq	56(%rsp), %rdx
	leaq	112(%rsp), %rbp
	movq	%rbp, %rdi
	callq	hipEventElapsedTime
	movl	$_ZSt4cout, %edi
	movl	$.L.str.6, %esi
	movl	$48, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movq	%r13, %rsi
	callq	_ZNSo9_M_insertIyEERSoT_
	movq	%rax, %r13
	movl	$.L.str.4, %esi
	movl	$10, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	cvtss2sd	(%rbp), %xmm0
	movq	%r13, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r13
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%r14, %rdi
	callq	_ZdaPv
	movq	%r15, %rdi
	callq	_ZdaPv
	movq	%rbx, %rdi
	callq	_ZdaPv
	movq	%r12, %rdi
	callq	_ZdaPv
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	80(%rsp), %rdi
	callq	hipFree
	movq	72(%rsp), %rdi
	callq	hipFree
	movq	96(%rsp), %rdi
	callq	hipEventDestroy
	movq	88(%rsp), %rdi
	callq	hipEventDestroy
	movq	64(%rsp), %rdi
	callq	hipEventDestroy
	movq	56(%rsp), %rdi
	callq	hipEventDestroy
	xorl	%eax, %eax
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	main, .Lfunc_end5-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	.LBB6_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB6_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z18prodScalareGPUNOSHPiS_Pyi, %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	$_Z16prodScalareGPUSHPiS_Pyi, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end6:
	.size	__hip_module_ctor, .Lfunc_end6-__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	.LBB7_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
.LBB7_2:
	retq
.Lfunc_end7:
	.size	__hip_module_dtor, .Lfunc_end7-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"-------------------"
	.size	.L.str, 20

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	" "
	.size	.L.str.1, 2

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

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

	.type	.L.str.2,@object                # @.str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.2:
	.asciz	"%d"
	.size	.L.str.2, 3

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"il prod scalare (calcolato on cpu): "
	.size	.L.str.3, 37

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	" , tempo: "
	.size	.L.str.4, 11

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"prod scalare calcolato on gpu senza shared memory: "
	.size	.L.str.5, 52

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"prod scalare calcolato su gpu con shared memory "
	.size	.L.str.6, 49

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z18prodScalareGPUNOSHPiS_Pyi"
	.size	.L__unnamed_1, 30

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

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z18prodScalareGPUNOSHPiS_Pyi ; -- Begin function _Z18prodScalareGPUNOSHPiS_Pyi
	.globl	_Z18prodScalareGPUNOSHPiS_Pyi
	.p2align	8
	.type	_Z18prodScalareGPUNOSHPiS_Pyi,@function
_Z18prodScalareGPUNOSHPiS_Pyi:          ; @_Z18prodScalareGPUNOSHPiS_Pyi
; %bb.0:
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x20
	s_load_b64 s[4:5], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s6, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s2, s3, s6
	s_ashr_i32 s3, s2, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s2, s2, s3
	s_xor_b32 s7, s2, s3
	s_load_b32 s2, s[0:1], 0x18
	v_cvt_f32_u32_e32 v1, s7
	s_sub_i32 s10, 0, s7
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s9, s2, 31
	v_cvt_u32_f32_e32 v1, v1
	s_add_i32 s11, s2, s9
	s_xor_b32 s3, s9, s3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_readfirstlane_b32 s8, v1
	v_mad_u64_u32 v[2:3], null, s15, s6, v[0:1]
	s_mul_i32 s10, s10, s8
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	s_mul_hi_u32 s6, s8, s10
	s_xor_b32 s10, s11, s9
	s_add_i32 s8, s8, s6
	v_ashrrev_i32_e32 v3, 31, v2
	s_mul_hi_u32 s6, s10, s8
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mul_i32 s8, s6, s7
	s_add_i32 s9, s6, 1
	s_sub_i32 s8, s10, s8
	v_lshlrev_b64 v[0:1], 3, v[2:3]
	s_sub_i32 s10, s8, s7
	s_cmp_ge_u32 s8, s7
	v_mov_b32_e32 v3, 0
	s_cselect_b32 s6, s9, s6
	s_cselect_b32 s8, s10, s8
	s_add_i32 s9, s6, 1
	s_cmp_ge_u32 s8, s7
	v_mov_b32_e32 v4, v3
	s_cselect_b32 s6, s9, s6
	v_add_co_u32 v0, vcc_lo, s4, v0
	s_xor_b32 s6, s6, s3
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	s_sub_i32 s3, s6, s3
	s_mov_b32 s4, 0
	s_cmp_lt_i32 s3, 1
	global_store_b64 v[0:1], v[3:4], off
	s_cbranch_scc1 .LBB0_5
; %bb.1:                                ; %.lr.ph.preheader
	s_load_b128 s[8:11], s[0:1], 0x0
	v_mul_lo_u32 v2, v2, s3
                                        ; implicit-def: $sgpr0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[7:8], 2, v[2:3]
	v_mov_b32_e32 v3, 0
	v_mov_b32_e32 v4, 0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v5, vcc_lo, s8, v7
	v_add_co_ci_u32_e32 v6, vcc_lo, s9, v8, vcc_lo
	v_add_co_u32 v7, vcc_lo, s10, v7
	v_add_co_ci_u32_e32 v8, vcc_lo, s11, v8, vcc_lo
.LBB0_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_or_b32 s0, s0, exec_lo
	s_mov_b32 s1, exec_lo
	v_cmpx_gt_i32_e64 s2, v2
	s_cbranch_execz .LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	global_load_b32 v9, v[5:6], off
	global_load_b32 v10, v[7:8], off
	v_add_co_u32 v5, vcc_lo, v5, 4
	v_add_co_ci_u32_e32 v6, vcc_lo, 0, v6, vcc_lo
	s_add_i32 s3, s3, -1
	v_add_co_u32 v7, vcc_lo, v7, 4
	v_add_co_ci_u32_e32 v8, vcc_lo, 0, v8, vcc_lo
	s_cmp_eq_u32 s3, 0
	v_add_nc_u32_e32 v2, 1, v2
	s_cselect_b32 s5, -1, 0
	s_and_not1_b32 s0, s0, exec_lo
	s_and_b32 s5, s5, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	s_or_b32 s0, s0, s5
	s_waitcnt vmcnt(0)
	v_mul_lo_u32 v9, v10, v9
	v_ashrrev_i32_e32 v10, 31, v9
	v_add_co_u32 v3, vcc_lo, v3, v9
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, v4, v10, vcc_lo
	global_store_b64 v[0:1], v[3:4], off
.LBB0_4:                                ; %Flow
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s1, exec_lo, s0
	s_or_b32 s4, s1, s4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s4
	s_cbranch_execnz .LBB0_2
.LBB0_5:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z18prodScalareGPUNOSHPiS_Pyi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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 11
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z18prodScalareGPUNOSHPiS_Pyi, .Lfunc_end0-_Z18prodScalareGPUNOSHPiS_Pyi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 508
; NumSgprs: 18
; NumVgprs: 11
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 11
; 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	_Z16prodScalareGPUSHPiS_Pyi ; -- Begin function _Z16prodScalareGPUSHPiS_Pyi
	.globl	_Z16prodScalareGPUSHPiS_Pyi
	.p2align	8
	.type	_Z16prodScalareGPUSHPiS_Pyi,@function
_Z16prodScalareGPUSHPiS_Pyi:            ; @_Z16prodScalareGPUSHPiS_Pyi
; %bb.0:
	s_clause 0x1
	s_load_b32 s3, s[0:1], 0x2c
	s_load_b32 s4, s[0:1], 0x20
	v_mov_b32_e32 v3, 0
	v_lshl_add_u32 v8, v0, 2, 0
	s_mov_b32 s2, s15
	s_waitcnt lgkmcnt(0)
	s_and_b32 s8, s3, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s3, s4, s8
	s_ashr_i32 s9, s3, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s3, s3, s9
	s_xor_b32 s10, s3, s9
	s_load_b32 s3, s[0:1], 0x18
	v_cvt_f32_u32_e32 v1, s10
	s_sub_i32 s5, 0, s10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s11, s3, 31
	v_cvt_u32_f32_e32 v1, v1
	s_add_i32 s6, s3, s11
	s_xor_b32 s9, s11, s9
	s_xor_b32 s12, s6, s11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_readfirstlane_b32 s4, v1
	s_mul_i32 s5, s5, s4
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s5, s4, s5
	s_add_i32 s4, s4, s5
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mul_hi_u32 s13, s12, s4
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	s_mul_i32 s14, s13, s10
	ds_store_b32 v8, v3
	s_sub_i32 s11, s12, s14
	s_add_i32 s12, s13, 1
	s_sub_i32 s14, s11, s10
	s_cmp_ge_u32 s11, s10
	s_cselect_b32 s12, s12, s13
	s_cselect_b32 s11, s14, s11
	s_add_i32 s13, s12, 1
	s_cmp_ge_u32 s11, s10
	s_cselect_b32 s10, s13, s12
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_xor_b32 s10, s10, s9
	s_sub_i32 s9, s10, s9
	s_mov_b32 s10, 0
	s_cmp_lt_i32 s9, 1
	s_cbranch_scc1 .LBB1_6
; %bb.1:                                ; %.lr.ph.preheader
	v_mad_u64_u32 v[1:2], null, s2, s8, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v1, v1, s9
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[6:7], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v4, vcc_lo, s4, v6
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v7, vcc_lo
	v_add_co_u32 v6, vcc_lo, s6, v6
	v_add_co_ci_u32_e32 v7, vcc_lo, s7, v7, vcc_lo
                                        ; implicit-def: $sgpr4
.LBB1_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_or_b32 s4, s4, exec_lo
	s_mov_b32 s5, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB1_4
; %bb.3:                                ;   in Loop: Header=BB1_2 Depth=1
	global_load_b32 v2, v[4:5], off
	global_load_b32 v11, v[6:7], off
	v_add_co_u32 v4, vcc_lo, v4, 4
	s_add_i32 s9, s9, -1
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
	s_cmp_eq_u32 s9, 0
	v_add_co_u32 v6, vcc_lo, v6, 4
	s_cselect_b32 s6, -1, 0
	v_add_co_ci_u32_e32 v7, vcc_lo, 0, v7, vcc_lo
	v_add_nc_u32_e32 v1, 1, v1
	s_and_not1_b32 s4, s4, exec_lo
	s_and_b32 s6, s6, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	s_or_b32 s4, s4, s6
	s_waitcnt vmcnt(0)
	v_mad_u64_u32 v[9:10], null, v11, v2, v[3:4]
	v_mov_b32_e32 v3, v9
	ds_store_b32 v8, v9
.LBB1_4:                                ; %Flow54
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s5
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s5, exec_lo, s4
	s_or_b32 s10, s5, s10
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s10
	s_cbranch_execnz .LBB1_2
; %bb.5:                                ; %Flow55
	s_or_b32 exec_lo, exec_lo, s10
.LBB1_6:                                ; %._crit_edge
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_mov_b32 s3, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB1_11
; %bb.7:
	v_mov_b32_e32 v0, 0
	s_mov_b32 s3, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[4:5], s[2:3], 3
	s_add_u32 s0, s0, s4
	s_delay_alu instid0(VALU_DEP_1)
	v_mov_b32_e32 v1, v0
	s_addc_u32 s1, s1, s5
	s_cmp_eq_u32 s8, 0
	global_store_b64 v0, v[0:1], s[0:1]
	s_cbranch_scc1 .LBB1_11
; %bb.8:                                ; %.lr.ph31.preheader
	v_mov_b32_e32 v0, 0
	v_mov_b32_e32 v1, 0
.LBB1_9:                                ; %.lr.ph31
                                        ; =>This Inner Loop Header: Depth=1
	v_mov_b32_e32 v2, s3
	s_add_i32 s8, s8, -1
	s_add_i32 s3, s3, 4
	s_cmp_lg_u32 s8, 0
	ds_load_b32 v2, v2
	s_waitcnt lgkmcnt(0)
	v_ashrrev_i32_e32 v3, 31, v2
	v_add_co_u32 v0, vcc_lo, v0, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
	s_cbranch_scc1 .LBB1_9
; %bb.10:                               ; %..loopexit_crit_edge
	v_mov_b32_e32 v2, 0
	global_store_b64 v2, v[0:1], s[0:1]
.LBB1_11:                               ; %.loopexit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z16prodScalareGPUSHPiS_Pyi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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 12
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z16prodScalareGPUSHPiS_Pyi, .Lfunc_end1-_Z16prodScalareGPUSHPiS_Pyi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 632
; NumSgprs: 18
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 12
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

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

	.end_amdgpu_metadata
