
#include <stdio.h>
#include <sys/timeb.h>
#include <math.h>
#include <cuda.h>

// nbre de threads dans une dimension (on travaille en 1D)
#define NBTHREADS 1024

// Pour la generation aleatoire des valeurs
#define MAX_VAL 10
#define MIN_VAL 0

void vecAleatoire(int *v, int n);
void vecAff(int *v, int n);

// voisin dans la dimension d du processeur p
unsigned int voisin(unsigned int p, unsigned int d);

// calcul de la somme d'un vecteur sur CPU
// pour les tests
int somCPU(int *t, int n);

// calcul de la somme sur l'hypercube (ne fonctionne que pour un vecteur comportant moins de NBTHREADS elements !!!)
__global__ void somHypercubeKernel(int* d_t, int d, int total);
// calcul de la somme sur l'hypercube dans la dimension dc (suppose que toutes les dimensions inferieures ont ete calculees)
__global__ void somHypercubeUneDimensionKernel(int* d_t, int d, int dc, int total);
// fonction qui appel les noyaux
float somHypercube(int* h_t, int d);

int GPUInfo();

int main(int argc, char* argv[]){
    int dim=3, n;
    int *tab;
    int somme;
    float ms;
    // pour mesurer le temps sur CPU
    struct timeb tav, tap ;
    double te;
    // recuperation des parametres en ligne de commandes
    if (argc==2) dim= strtol(argv[1], NULL, 10);
    // allocation et initialisation du tableau
    // pour calculer le max de n=2^dim valeurs, nous avons besoin d'un vecteur de taille 2*n
    n=(int)pow(2,dim);
    // l'occupation memoire du vecteur en Mo
    float tailleMo=sizeof(int)*n/float(512*1024);
    tab=(int*)malloc(sizeof(int)*2*n);
    vecAleatoire(tab,2*n);
    // la partie droite du tableau est egale a 0
    for(int i=0;i<n;i++) tab[n+i]=0;
    // quel GPU ?
    GPUInfo();
    // calcul de la somme sur CPU
    ftime(&tav);
    somme=somCPU(tab,n);
    ftime(&tap);
    te = (double)((tap.time*1000+tap.millitm)-(tav.time*1000+tav.millitm))/1000 ;
    // affichage du tableau
    /* vecAff(tab,2*n);
    printf("\n"); */
    // calcul de la somme sur GPU
    printf("----\nHypercube de dimension %d, soit %d valeurs dans le vecteur (%f Mo).\n", dim, n, tailleMo);
    printf("Temps d'execution sur CPU : %f ms.\n",te);
    ms=somHypercube(tab,dim);
    printf("Temps d'execution sur GPU : %f ms.\n",ms);
    // le resultat peut etre a gauche ou a droite, en fonction de la parite de dim
    printf("SommeCPU : %d, sommeGPU : %d (ecart GPU : %d)\n",somme, tab[n*(dim%2)], tab[n*(dim%2)+n-1]-tab[n*(dim%2)]);
    // affichage du tableau resultat
    // vecAff(tab,2*n);
}

// calcul la somme de tous les elements contenus dans le vecteur h_t
float somHypercube(int* h_t, int d){
    int n = (int)pow(2,d);
    // la taille du vecteur est de 2*n elements
    long size = 2*n*sizeof(int);
    int nbBlocs;
    int *d_t;
    // pour mesurer le temps en cuda
    cudaEvent_t start, stop;
    float milliseconds = 0;
    cudaEventCreate(&start);
    cudaEventCreate(&stop);

    // allocations du vecteur
    printf("Allocation de %ld octets (%f Mo) sur le GPU.\n",size,(float)size/1024/1024);
    if (cudaMalloc((void **) &d_t, size)!=cudaSuccess) {
        printf ("Pb allocation !!!\n");
        exit(1);
    }
    // copies hote vers device
    cudaMemcpy(d_t, h_t, size, cudaMemcpyHostToDevice);

    // le calcul sur GPU
    nbBlocs=(n-1)/NBTHREADS+1;
    printf("Appel du noyau <<<%d blocs, %d>>>.\n", nbBlocs, NBTHREADS);
    // 2 cas de figures : (1) un seul bloc ou (2) plus d'un blocs
    cudaEventRecord(start);
    if(nbBlocs==1) somHypercubeKernel<<<nbBlocs,NBTHREADS>>>(d_t, d, n);
    else {
        // on appelle le noyau pour chaque dimension
        // afin de s'assurer que tous les blocs soient resolus avant de passer a la dimension suivante
        for(int i=0;i<d;i++) {
            // printf("somHypercubeUneDimensionKernel<<<%d,%d>>>(d_t,%d,%d,%d)\n",nbBlocs,NBTHREADS,d,i,n);
            somHypercubeUneDimensionKernel<<<nbBlocs,NBTHREADS>>>(d_t, d, i, n);
            // attente de la fin du noyau dans la dimension courante
            cudaDeviceSynchronize();
        }
    }
    cudaEventRecord(stop);
    cudaEventSynchronize(stop);
    cudaEventElapsedTime(&milliseconds, start, stop);

    // copie device vers hote
    cudaMemcpy(h_t, d_t, size, cudaMemcpyDeviceToHost);
    // liberation de la memoire
    cudaFree(d_t);
    return milliseconds;
}

// calcul de la somme sur l'hypercube (ne fonctionne que pour un vecteur comportant moins de NBTHREADS elements !!!)
__global__ void somHypercubeKernel(int* d_t, int d, int total){
    int p,voisin;
    int val;
    p=threadIdx.x+blockDim.x*blockIdx.x;
    // attention pour eviter le conflit d'ecriture, la longueur de d_t est egale a 2*total
    // suivant la parite de i, on utilise la partie gauche ou droite du tableau pour la lecture et inversement pour l'ecriture
    if (p<total) {
        for(int i=0;i<d;i++){
            voisin=p^(((unsigned int)1)<<i);
            val=d_t[total*(i%2)+voisin];
            d_t[total*((i+1)%2)+p]=d_t[total*(i%2)+p]+val;
            __syncthreads();
        }
    }
}

// calcul de la somme sur l'hypercube dans la dimension dc (suppose que toutes les dimensions inferieures ont ete calculees)
// ce noyau devrait etre appele d fois depuis l'hote !!!
__global__ void somHypercubeUneDimensionKernel(int* d_t, int d, int i, int total) {
    int p,voisin;
    int val;
    p=threadIdx.x+blockDim.x*blockIdx.x;
    // attention pour eviter le conflit d'ecriture, la longueur de d_t est egale a 2*total
    // suivant la parite de i, on utilise la partie gauche ou droite du tableau pour la lecture et inversement pour l'ecriture
    if (p<total) {
        // voisin=p^(((unsigned int)1)<<i);
        voisin=p^(1<<i);
        val=d_t[total*(i%2)+voisin];
        d_t[total*((i+1)%2)+p]=d_t[total*(i%2)+p]+val;
        __syncthreads();
    }
}


// rappel sur les fonctions C pour manipuler les bits directement
// https://zestedesavoir.com/tutoriels/755/le-langage-c-1/notions-avancees/manipulation-des-bits/
unsigned int voisin(unsigned int p, unsigned int d) {
    // ou exclusif entre le numero du processeur
    // et le bit a 1 en position d
    return (p^(((unsigned int)1)<<d));
}

// calcul de la somme d'un vecteur sur CPU
int somCPU(int *t, int n) {
    int somme=0;
    for(int i=0;i<n;i++) somme+=t[i];
    return somme;
}

// Initialisation aleatoire d'un vecteur
void vecAleatoire(int *v, int n) {
    int i;
    for(i=0;i<n;i++){
        v[i]= (int)((double)rand()/RAND_MAX*MAX_VAL) + MIN_VAL;
    }
}

// Affiche un vecteur
void vecAff(int *v, int n){
    int i;
    printf("[");
    for(i=0;i<n-1;i++) printf("%d ",v[i]);
    printf("%f]",v[n-1]);
}

int GPUInfo(){
    int deviceCount;
    cudaGetDeviceCount(&deviceCount);
    for (int dev = 0; dev < deviceCount; dev++) {
        cudaDeviceProp deviceProp;
        cudaGetDeviceProperties(&deviceProp, dev);
        if (dev == 0) {
            if (deviceProp.major == 9999 && deviceProp.minor == 9999) {
                printf("No CUDA GPU has been detected");
                return -1;
            } else if (deviceCount == 1) {
                printf("There is 1 device supporting CUDA\n");
                printf("Device %d, name: %s\n",  dev, deviceProp.name);
                printf("Computational Capabilities: %d.%d\n", deviceProp.major, deviceProp.minor);
                printf("Maximum global memory size: %ld bytes\n", deviceProp.totalGlobalMem);
                printf("Maximum shared memory size per block: %ld bytes\n", deviceProp.sharedMemPerBlock);
                printf("Warp size: %d\n", deviceProp.warpSize);
                printf("Maximum number of blocks per multiProcessor: %d\n",deviceProp.maxBlocksPerMultiProcessor);
                printf("Maximum number of threads per multiProcessor: %d\n",deviceProp.maxThreadsPerMultiProcessor);
                printf("Maximum grid size : %d x %d x %d blocks.\n",deviceProp.maxGridSize[0], deviceProp.maxGridSize[1], deviceProp.maxGridSize[2]);
            } else {
                printf("There are %d devices supporting CUDA\n", deviceCount);
            }
        }
    }
    return deviceCount;
}
	.file	"tmpxft_00377c5c_00000000-6_hypercube.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2036:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2036:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z6voisinjj
	.type	_Z6voisinjj, @function
_Z6voisinjj:
.LFB2029:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	btcl	%esi, %eax
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z6voisinjj, .-_Z6voisinjj
	.globl	_Z6somCPUPii
	.type	_Z6somCPUPii, @function
_Z6somCPUPii:
.LFB2030:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	xorl	%edx, %edx
.L4:
	cmpl	%eax, %esi
	jle	.L7
	addl	(%rdi,%rax,4), %edx
	incq	%rax
	jmp	.L4
.L7:
	movl	%edx, %eax
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z6somCPUPii, .-_Z6somCPUPii
	.globl	_Z12vecAleatoirePii
	.type	_Z12vecAleatoirePii, @function
_Z12vecAleatoirePii:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
.L9:
	cmpl	%ebx, %ebp
	jle	.L12
	call	rand@PLT
	cvtsi2sdl	%eax, %xmm0
	divsd	.LC0(%rip), %xmm0
	mulsd	.LC1(%rip), %xmm0
	cvttsd2sil	%xmm0, %eax
	movl	%eax, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L9
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z12vecAleatoirePii, .-_Z12vecAleatoirePii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"["
.LC3:
	.string	"%d "
.LC4:
	.string	"%f]"
	.text
	.globl	_Z6vecAffPii
	.type	_Z6vecAffPii, @function
_Z6vecAffPii:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorl	%eax, %eax
	leaq	.LC3(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	movl	$2, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%esi, %rbx
	leaq	.LC2(%rip), %rsi
	pushq	%r8
	.cfi_def_cfa_offset 48
	call	__printf_chk@PLT
.L14:
	leal	-1(%rbx), %eax
	cmpl	%r12d, %eax
	jle	.L17
	movl	0(%rbp,%r12,4), %edx
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r12
	call	__printf_chk@PLT
	jmp	.L14
.L17:
	movl	-4(%rbp,%rbx,4), %edx
	leaq	.LC4(%rip), %rsi
	popq	%rcx
	.cfi_def_cfa_offset 40
	movl	$2, %edi
	popq	%rbx
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2032:
	.size	_Z6vecAffPii, .-_Z6vecAffPii
	.section	.rodata.str1.1
.LC5:
	.string	"No CUDA GPU has been detected"
.LC6:
	.string	"There is 1 device supporting CUDA\n"
.LC7:
	.string	"Device %d, name: %s\n"
.LC8:
	.string	"Computational Capabilities: %d.%d\n"
.LC9:
	.string	"Maximum global memory size: %ld bytes\n"
.LC10:
	.string	"Maximum shared memory size per block: %ld bytes\n"
.LC11:
	.string	"Warp size: %d\n"
.LC12:
	.string	"Maximum number of blocks per multiProcessor: %d\n"
.LC13:
	.string	"Maximum number of threads per multiProcessor: %d\n"
.LC14:
	.string	"Maximum grid size : %d x %d x %d blocks.\n"
.LC15:
	.string	"There are %d devices supporting CUDA\n"
	.text
	.globl	_Z7GPUInfov
	.type	_Z7GPUInfov, @function
_Z7GPUInfov:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movabsq	$42945378002703, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	subq	$1056, %rsp
	.cfi_def_cfa_offset 1088
	movq	%fs:40, %rax
	movq	%rax, 1048(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdi
	call	cudaGetDeviceCount@PLT
.L19:
	movl	12(%rsp), %eax
	cmpl	%ebx, %eax
	jle	.L18
	leaq	16(%rsp), %rbp
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	testl	%ebx, %ebx
	jne	.L20
	cmpq	%r12, 376(%rsp)
	jne	.L21
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	orl	$-1, %eax
	jmp	.L18
.L21:
	movl	12(%rsp), %edx
	cmpl	$1, %edx
	jne	.L23
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbp, %rcx
	xorl	%edx, %edx
	movl	$2, %edi
	leaq	.LC7(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	380(%rsp), %ecx
	movl	$2, %edi
	xorl	%eax, %eax
	movl	376(%rsp), %edx
	leaq	.LC8(%rip), %rsi
	call	__printf_chk@PLT
	movq	304(%rsp), %rdx
	leaq	.LC9(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	312(%rsp), %rdx
	leaq	.LC10(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	324(%rsp), %edx
	leaq	.LC11(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	728(%rsp), %edx
	leaq	.LC12(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	640(%rsp), %edx
	leaq	.LC13(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	360(%rsp), %r8d
	xorl	%eax, %eax
	movl	356(%rsp), %ecx
	movl	352(%rsp), %edx
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	jmp	.L20
.L23:
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L20:
	incl	%ebx
	jmp	.L19
.L18:
	movq	1048(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	addq	$1056, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z7GPUInfov, .-_Z7GPUInfov
	.globl	_Z40__device_stub__Z18somHypercubeKernelPiiiPiii
	.type	_Z40__device_stub__Z18somHypercubeKernelPiiiPiii, @function
_Z40__device_stub__Z18somHypercubeKernelPiiiPiii:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	32(%rsp), %rdi
	movl	%esi, 4(%rsp)
	leaq	44(%rsp), %rsi
	movl	%edx, (%rsp)
	leaq	16(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 40(%rsp)
	movq	%rax, 80(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L27
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z18somHypercubeKernelPiii(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L27:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z40__device_stub__Z18somHypercubeKernelPiiiPiii, .-_Z40__device_stub__Z18somHypercubeKernelPiiiPiii
	.globl	_Z18somHypercubeKernelPiii
	.type	_Z18somHypercubeKernelPiii, @function
_Z18somHypercubeKernelPiii:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z18somHypercubeKernelPiiiPiii
	.cfi_endproc
.LFE2059:
	.size	_Z18somHypercubeKernelPiii, .-_Z18somHypercubeKernelPiii
	.globl	_Z53__device_stub__Z30somHypercubeUneDimensionKernelPiiiiPiiii
	.type	_Z53__device_stub__Z30somHypercubeUneDimensionKernelPiiiiPiiii, @function
_Z53__device_stub__Z30somHypercubeUneDimensionKernelPiiiiPiiii:
.LFB2060:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 12(%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	20(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%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	.L32
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z30somHypercubeUneDimensionKernelPiiii(%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
.L32:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2060:
	.size	_Z53__device_stub__Z30somHypercubeUneDimensionKernelPiiiiPiiii, .-_Z53__device_stub__Z30somHypercubeUneDimensionKernelPiiiiPiiii
	.globl	_Z30somHypercubeUneDimensionKernelPiiii
	.type	_Z30somHypercubeUneDimensionKernelPiiii, @function
_Z30somHypercubeUneDimensionKernelPiiii:
.LFB2061:
	.cfi_startproc
	endbr64
	jmp	_Z53__device_stub__Z30somHypercubeUneDimensionKernelPiiiiPiiii
	.cfi_endproc
.LFE2061:
	.size	_Z30somHypercubeUneDimensionKernelPiiii, .-_Z30somHypercubeUneDimensionKernelPiiii
	.section	.rodata.str1.1
.LC19:
	.string	"Allocation de %ld octets (%f Mo) sur le GPU.\n"
.LC20:
	.string	"Pb allocation !!!\n"
.LC21:
	.string	"Appel du noyau <<<%d blocs, %d>>>.\n"
	.text
	.globl	_Z12somHypercubePii
	.type	_Z12somHypercubePii, @function
_Z12somHypercubePii:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	cvtsi2sdl	%esi, %xmm1
	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
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movsd	.LC16(%rip), %xmm0
	movq	%rdi, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	call	pow@PLT
	leaq	32(%rsp), %rdi
	movl	$0x00000000, 20(%rsp)
	cvttsd2sil	%xmm0, %r14d
	call	cudaEventCreate@PLT
	leaq	40(%rsp), %rdi
	call	cudaEventCreate@PLT
	movss	.LC18(%rip), %xmm1
	leaq	.LC19(%rip), %rsi
	movb	$1, %al
	movl	$2, %edi
	leal	(%r14,%r14), %ebx
	movslq	%ebx, %rbx
	salq	$2, %rbx
	cvtsi2ssq	%rbx, %xmm0
	movq	%rbx, %rdx
	mulss	%xmm1, %xmm0
	mulss	%xmm1, %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	leaq	24(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L38
	movl	$2, %edi
	leaq	.LC20(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L38:
	movq	8(%rsp), %rsi
	movq	24(%rsp), %rdi
	movq	%rbx, %rdx
	xorl	%r13d, %r13d
	movabsq	$4294968320, %r15
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	leal	-1(%r14), %eax
	movl	$1024, %ecx
	leaq	.LC21(%rip), %rsi
	cltd
	movl	$2, %edi
	idivl	%ecx
	leal	1(%rax), %ebp
	xorl	%eax, %eax
	movl	%ebp, %edx
	call	__printf_chk@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	cmpl	$1, %ebp
	jne	.L39
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r15, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movq	%r15, 60(%rsp)
	movl	$1, 68(%rsp)
	movq	%rdi, 48(%rsp)
	movl	$1, 56(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L41
	movq	24(%rsp), %rdi
	movl	%r14d, %edx
	movl	%r12d, %esi
	call	_Z40__device_stub__Z18somHypercubeKernelPiiiPiii
	jmp	.L41
.L43:
	movl	%ebp, 48(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r15, %rdx
	movabsq	$4294967297, %rax
	movl	$1, %ecx
	movq	%r15, 60(%rsp)
	movq	%rax, 52(%rsp)
	movq	48(%rsp), %rdi
	movl	56(%rsp), %esi
	movl	$1, 68(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L42
	movq	24(%rsp), %rdi
	movl	%r14d, %ecx
	movl	%r13d, %edx
	movl	%r12d, %esi
	call	_Z53__device_stub__Z30somHypercubeUneDimensionKernelPiiiiPiiii
.L42:
	call	cudaDeviceSynchronize@PLT
	incl	%r13d
.L39:
	cmpl	%r12d, %r13d
	jl	.L43
.L41:
	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	20(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	24(%rsp), %rsi
	movq	8(%rsp), %rdi
	movq	%rbx, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movss	20(%rsp), %xmm0
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L44
	call	__stack_chk_fail@PLT
.L44:
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	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
.LFE2028:
	.size	_Z12somHypercubePii, .-_Z12somHypercubePii
	.section	.rodata.str1.1
.LC24:
	.string	"----\nHypercube de dimension %d, soit %d valeurs dans le vecteur (%f Mo).\n"
.LC25:
	.string	"Temps d'execution sur CPU : %f ms.\n"
.LC26:
	.string	"Temps d'execution sur GPU : %f ms.\n"
.LC27:
	.string	"SommeCPU : %d, sommeGPU : %d (ecart GPU : %d)\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	$3, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	cmpl	$2, %edi
	jne	.L49
	movq	8(%rsi), %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	call	__isoc23_strtol@PLT
	movl	%eax, %ebx
.L49:
	cvtsi2sdl	%ebx, %xmm1
	movsd	.LC16(%rip), %xmm0
	call	pow@PLT
	cvttsd2sil	%xmm0, %r13d
	movslq	%r13d, %rdi
	movq	%rdi, %r12
	salq	$2, %r12
	js	.L50
	cvtsi2ssq	%r12, %xmm0
	jmp	.L51
.L50:
	movq	%r12, %rax
	shrq	%rax
	cvtsi2ssq	%rax, %xmm0
	addss	%xmm0, %xmm0
.L51:
	mulss	.LC22(%rip), %xmm0
	salq	$3, %rdi
	movd	%xmm0, %r14d
	call	malloc@PLT
	leal	(%r13,%r13), %esi
	movq	%rax, %rbp
	movq	%rax, %rdi
	call	_Z12vecAleatoirePii
	addq	%rbp, %r12
	xorl	%eax, %eax
.L52:
	cmpl	%eax, %r13d
	jle	.L58
	xorl	%edx, %edx
	movl	%edx, (%r12,%rax,4)
	incq	%rax
	jmp	.L52
.L58:
	call	_Z7GPUInfov
	leaq	8(%rsp), %rdi
	call	ftime@PLT
	movl	%r13d, %esi
	movq	%rbp, %rdi
	call	_Z6somCPUPii
	leaq	24(%rsp), %rdi
	movl	%eax, %r12d
	call	ftime@PLT
	movzwl	32(%rsp), %edx
	imulq	$1000, 24(%rsp), %rax
	movd	%r14d, %xmm2
	movzwl	16(%rsp), %ecx
	leaq	.LC24(%rip), %rsi
	movl	$2, %edi
	addq	%rdx, %rax
	imulq	$1000, 8(%rsp), %rdx
	addq	%rcx, %rdx
	movl	%r13d, %ecx
	subq	%rdx, %rax
	movl	%ebx, %edx
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	divsd	.LC23(%rip), %xmm0
	movq	%xmm0, %r15
	cvtss2sd	%xmm2, %xmm0
	call	__printf_chk@PLT
	movq	%r15, %xmm0
	movl	$2, %edi
	leaq	.LC25(%rip), %rsi
	movb	$1, %al
	call	__printf_chk@PLT
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	_Z12somHypercubePii
	leaq	.LC26(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
	movl	%ebx, %eax
	movl	$2, %ecx
	cltd
	leaq	.LC27(%rip), %rsi
	movl	$2, %edi
	idivl	%ecx
	imull	%r13d, %edx
	movslq	%edx, %rax
	addl	%r13d, %edx
	movslq	%edx, %rdx
	movl	0(%rbp,%rax,4), %ecx
	xorl	%eax, %eax
	movl	-4(%rbp,%rdx,4), %r8d
	movl	%r12d, %edx
	subl	%ecx, %r8d
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L54
	call	__stack_chk_fail@PLT
.L54:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC28:
	.string	"_Z30somHypercubeUneDimensionKernelPiiii"
.LC29:
	.string	"_Z18somHypercubeKernelPiii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2063:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC28(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z30somHypercubeUneDimensionKernelPiiii(%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	.LC29(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z18somHypercubeKernelPiii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2063:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	-4194304
	.long	1105199103
	.align 8
.LC1:
	.long	0
	.long	1076101120
	.align 8
.LC16:
	.long	0
	.long	1073741824
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC18:
	.long	981467136
	.align 4
.LC22:
	.long	905969664
	.section	.rodata.cst8
	.align 8
.LC23:
	.long	0
	.long	1083129856
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <stdio.h>
#include <sys/timeb.h>
#include <math.h>
#include <hip/hip_runtime.h>

// nbre de threads dans une dimension (on travaille en 1D)
#define NBTHREADS 1024

// Pour la generation aleatoire des valeurs
#define MAX_VAL 10
#define MIN_VAL 0

void vecAleatoire(int *v, int n);
void vecAff(int *v, int n);

// voisin dans la dimension d du processeur p
unsigned int voisin(unsigned int p, unsigned int d);

// calcul de la somme d'un vecteur sur CPU
// pour les tests
int somCPU(int *t, int n);

// calcul de la somme sur l'hypercube (ne fonctionne que pour un vecteur comportant moins de NBTHREADS elements !!!)
__global__ void somHypercubeKernel(int* d_t, int d, int total);
// calcul de la somme sur l'hypercube dans la dimension dc (suppose que toutes les dimensions inferieures ont ete calculees)
__global__ void somHypercubeUneDimensionKernel(int* d_t, int d, int dc, int total);
// fonction qui appel les noyaux
float somHypercube(int* h_t, int d);

int GPUInfo();

int main(int argc, char* argv[]){
    int dim=3, n;
    int *tab;
    int somme;
    float ms;
    // pour mesurer le temps sur CPU
    struct timeb tav, tap ;
    double te;
    // recuperation des parametres en ligne de commandes
    if (argc==2) dim= strtol(argv[1], NULL, 10);
    // allocation et initialisation du tableau
    // pour calculer le max de n=2^dim valeurs, nous avons besoin d'un vecteur de taille 2*n
    n=(int)pow(2,dim);
    // l'occupation memoire du vecteur en Mo
    float tailleMo=sizeof(int)*n/float(512*1024);
    tab=(int*)malloc(sizeof(int)*2*n);
    vecAleatoire(tab,2*n);
    // la partie droite du tableau est egale a 0
    for(int i=0;i<n;i++) tab[n+i]=0;
    // quel GPU ?
    GPUInfo();
    // calcul de la somme sur CPU
    ftime(&tav);
    somme=somCPU(tab,n);
    ftime(&tap);
    te = (double)((tap.time*1000+tap.millitm)-(tav.time*1000+tav.millitm))/1000 ;
    // affichage du tableau
    /* vecAff(tab,2*n);
    printf("\n"); */
    // calcul de la somme sur GPU
    printf("----\nHypercube de dimension %d, soit %d valeurs dans le vecteur (%f Mo).\n", dim, n, tailleMo);
    printf("Temps d'execution sur CPU : %f ms.\n",te);
    ms=somHypercube(tab,dim);
    printf("Temps d'execution sur GPU : %f ms.\n",ms);
    // le resultat peut etre a gauche ou a droite, en fonction de la parite de dim
    printf("SommeCPU : %d, sommeGPU : %d (ecart GPU : %d)\n",somme, tab[n*(dim%2)], tab[n*(dim%2)+n-1]-tab[n*(dim%2)]);
    // affichage du tableau resultat
    // vecAff(tab,2*n);
}

// calcul la somme de tous les elements contenus dans le vecteur h_t
float somHypercube(int* h_t, int d){
    int n = (int)pow(2,d);
    // la taille du vecteur est de 2*n elements
    long size = 2*n*sizeof(int);
    int nbBlocs;
    int *d_t;
    // pour mesurer le temps en cuda
    hipEvent_t start, stop;
    float milliseconds = 0;
    hipEventCreate(&start);
    hipEventCreate(&stop);

    // allocations du vecteur
    printf("Allocation de %ld octets (%f Mo) sur le GPU.\n",size,(float)size/1024/1024);
    if (hipMalloc((void **) &d_t, size)!=hipSuccess) {
        printf ("Pb allocation !!!\n");
        exit(1);
    }
    // copies hote vers device
    hipMemcpy(d_t, h_t, size, hipMemcpyHostToDevice);

    // le calcul sur GPU
    nbBlocs=(n-1)/NBTHREADS+1;
    printf("Appel du noyau <<<%d blocs, %d>>>.\n", nbBlocs, NBTHREADS);
    // 2 cas de figures : (1) un seul bloc ou (2) plus d'un blocs
    hipEventRecord(start);
    if(nbBlocs==1) somHypercubeKernel<<<nbBlocs,NBTHREADS>>>(d_t, d, n);
    else {
        // on appelle le noyau pour chaque dimension
        // afin de s'assurer que tous les blocs soient resolus avant de passer a la dimension suivante
        for(int i=0;i<d;i++) {
            // printf("somHypercubeUneDimensionKernel<<<%d,%d>>>(d_t,%d,%d,%d)\n",nbBlocs,NBTHREADS,d,i,n);
            somHypercubeUneDimensionKernel<<<nbBlocs,NBTHREADS>>>(d_t, d, i, n);
            // attente de la fin du noyau dans la dimension courante
            hipDeviceSynchronize();
        }
    }
    hipEventRecord(stop);
    hipEventSynchronize(stop);
    hipEventElapsedTime(&milliseconds, start, stop);

    // copie device vers hote
    hipMemcpy(h_t, d_t, size, hipMemcpyDeviceToHost);
    // liberation de la memoire
    hipFree(d_t);
    return milliseconds;
}

// calcul de la somme sur l'hypercube (ne fonctionne que pour un vecteur comportant moins de NBTHREADS elements !!!)
__global__ void somHypercubeKernel(int* d_t, int d, int total){
    int p,voisin;
    int val;
    p=threadIdx.x+blockDim.x*blockIdx.x;
    // attention pour eviter le conflit d'ecriture, la longueur de d_t est egale a 2*total
    // suivant la parite de i, on utilise la partie gauche ou droite du tableau pour la lecture et inversement pour l'ecriture
    if (p<total) {
        for(int i=0;i<d;i++){
            voisin=p^(((unsigned int)1)<<i);
            val=d_t[total*(i%2)+voisin];
            d_t[total*((i+1)%2)+p]=d_t[total*(i%2)+p]+val;
            __syncthreads();
        }
    }
}

// calcul de la somme sur l'hypercube dans la dimension dc (suppose que toutes les dimensions inferieures ont ete calculees)
// ce noyau devrait etre appele d fois depuis l'hote !!!
__global__ void somHypercubeUneDimensionKernel(int* d_t, int d, int i, int total) {
    int p,voisin;
    int val;
    p=threadIdx.x+blockDim.x*blockIdx.x;
    // attention pour eviter le conflit d'ecriture, la longueur de d_t est egale a 2*total
    // suivant la parite de i, on utilise la partie gauche ou droite du tableau pour la lecture et inversement pour l'ecriture
    if (p<total) {
        // voisin=p^(((unsigned int)1)<<i);
        voisin=p^(1<<i);
        val=d_t[total*(i%2)+voisin];
        d_t[total*((i+1)%2)+p]=d_t[total*(i%2)+p]+val;
        __syncthreads();
    }
}


// rappel sur les fonctions C pour manipuler les bits directement
// https://zestedesavoir.com/tutoriels/755/le-langage-c-1/notions-avancees/manipulation-des-bits/
unsigned int voisin(unsigned int p, unsigned int d) {
    // ou exclusif entre le numero du processeur
    // et le bit a 1 en position d
    return (p^(((unsigned int)1)<<d));
}

// calcul de la somme d'un vecteur sur CPU
int somCPU(int *t, int n) {
    int somme=0;
    for(int i=0;i<n;i++) somme+=t[i];
    return somme;
}

// Initialisation aleatoire d'un vecteur
void vecAleatoire(int *v, int n) {
    int i;
    for(i=0;i<n;i++){
        v[i]= (int)((double)rand()/RAND_MAX*MAX_VAL) + MIN_VAL;
    }
}

// Affiche un vecteur
void vecAff(int *v, int n){
    int i;
    printf("[");
    for(i=0;i<n-1;i++) printf("%d ",v[i]);
    printf("%f]",v[n-1]);
}

int GPUInfo(){
    int deviceCount;
    hipGetDeviceCount(&deviceCount);
    for (int dev = 0; dev < deviceCount; dev++) {
        hipDeviceProp_t deviceProp;
        hipGetDeviceProperties(&deviceProp, dev);
        if (dev == 0) {
            if (deviceProp.major == 9999 && deviceProp.minor == 9999) {
                printf("No CUDA GPU has been detected");
                return -1;
            } else if (deviceCount == 1) {
                printf("There is 1 device supporting CUDA\n");
                printf("Device %d, name: %s\n",  dev, deviceProp.name);
                printf("Computational Capabilities: %d.%d\n", deviceProp.major, deviceProp.minor);
                printf("Maximum global memory size: %ld bytes\n", deviceProp.totalGlobalMem);
                printf("Maximum shared memory size per block: %ld bytes\n", deviceProp.sharedMemPerBlock);
                printf("Warp size: %d\n", deviceProp.warpSize);
                printf("Maximum number of blocks per multiProcessor: %d\n",deviceProp.maxBlocksPerMultiProcessor);
                printf("Maximum number of threads per multiProcessor: %d\n",deviceProp.maxThreadsPerMultiProcessor);
                printf("Maximum grid size : %d x %d x %d blocks.\n",deviceProp.maxGridSize[0], deviceProp.maxGridSize[1], deviceProp.maxGridSize[2]);
            } else {
                printf("There are %d devices supporting CUDA\n", deviceCount);
            }
        }
    }
    return deviceCount;
}
	.text
	.file	"hypercube.hip"
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI0_0:
	.quad	0x3ff0000000000000              # double 1
.LCPI0_1:
	.quad	0x41dfffffffc00000              # double 2147483647
.LCPI0_2:
	.quad	0x4024000000000000              # double 10
.LCPI0_4:
	.quad	0x408f400000000000              # double 1000
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI0_3:
	.long	0x36000000                      # float 1.90734863E-6
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$3, %ebx
	cmpl	$2, %edi
	jne	.LBB0_2
# %bb.1:
	movq	8(%rsi), %rdi
	xorl	%esi, %esi
	movl	$10, %edx
	callq	__isoc23_strtol
	movq	%rax, %rbx
.LBB0_2:
	movsd	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero
	movl	%ebx, %edi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %ebp
	movslq	%ebp, %r12
	leaq	(,%r12,8), %rdi
	callq	malloc
	movq	%rax, %r14
	testl	%r12d, %r12d
	movq	%rbp, 16(%rsp)                  # 8-byte Spill
	jle	.LBB0_8
# %bb.3:                                # %.lr.ph.preheader.i
	leal	(,%rbp,2), %r15d
	xorl	%r13d, %r13d
.LBB0_4:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI0_1(%rip), %xmm0
	mulsd	.LCPI0_2(%rip), %xmm0
	cvttsd2si	%xmm0, %eax
	movl	%eax, (%r14,%r13,4)
	incq	%r13
	cmpq	%r13, %r15
	jne	.LBB0_4
# %bb.5:                                # %_Z12vecAleatoirePii.exit
	testl	%ebp, %ebp
	jle	.LBB0_8
# %bb.6:                                # %.lr.ph.preheader
	movl	%ebp, %r15d
	leaq	(,%r15,4), %rdx
	leaq	(%r14,%r15,4), %rdi
	xorl	%r13d, %r13d
	xorl	%esi, %esi
	callq	memset@PLT
	callq	_Z7GPUInfov
	leaq	24(%rsp), %rdi
	callq	ftime
	xorl	%ebp, %ebp
.LBB0_7:                                # %.lr.ph.i37
                                        # =>This Inner Loop Header: Depth=1
	addl	(%r14,%r13,4), %ebp
	incq	%r13
	cmpq	%r13, %r15
	jne	.LBB0_7
	jmp	.LBB0_9
.LBB0_8:                                # %_Z6somCPUPii.exit.critedge
	callq	_Z7GPUInfov
	leaq	24(%rsp), %rdi
	callq	ftime
	xorl	%ebp, %ebp
.LBB0_9:                                # %_Z6somCPUPii.exit
	movl	%r12d, %r15d
	shlq	$2, %r12
	testq	%r12, %r12
	js	.LBB0_10
# %bb.11:                               # %_Z6somCPUPii.exit
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r12, %xmm0
	jmp	.LBB0_12
.LBB0_10:
	shrq	%r12
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r12, %xmm0
	addss	%xmm0, %xmm0
.LBB0_12:                               # %_Z6somCPUPii.exit
	mulss	.LCPI0_3(%rip), %xmm0
	movss	%xmm0, 4(%rsp)                  # 4-byte Spill
	leaq	40(%rsp), %r12
	movq	%r12, %rdi
	callq	ftime
	movq	(%r12), %rax
	movzwl	8(%r12), %ecx
	movzwl	32(%rsp), %edx
	subq	%rdx, %rcx
	subq	24(%rsp), %rax
	imulq	$1000, %rax, %rax               # imm = 0x3E8
	addq	%rcx, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI0_4(%rip), %xmm0
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	xorps	%xmm0, %xmm0
	cvtss2sd	4(%rsp), %xmm0                  # 4-byte Folded Reload
	movl	$.L.str, %edi
	movl	%ebx, %esi
	movl	%r15d, %edx
	movb	$1, %al
	callq	printf
	movl	$.L.str.1, %edi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	printf
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_Z12somHypercubePii
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	movl	%ebx, %eax
	shrl	$31, %eax
	addl	%ebx, %eax
	andl	$-2, %eax
	subl	%eax, %ebx
	movq	16(%rsp), %rcx                  # 8-byte Reload
	imull	%ecx, %ebx
	movslq	%ebx, %rax
	movl	(%r14,%rax,4), %edx
	addl	%ecx, %eax
	cltq
	movl	-4(%r14,%rax,4), %ecx
	subl	%edx, %ecx
	movl	$.L.str.3, %edi
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	xorl	%eax, %eax
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z12vecAleatoirePii
.LCPI1_0:
	.quad	0x41dfffffffc00000              # double 2147483647
.LCPI1_1:
	.quad	0x4024000000000000              # double 10
	.text
	.globl	_Z12vecAleatoirePii
	.type	_Z12vecAleatoirePii,@function
_Z12vecAleatoirePii:                    # @_Z12vecAleatoirePii
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB1_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
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	divsd	.LCPI1_0(%rip), %xmm0
	mulsd	.LCPI1_1(%rip), %xmm0
	cvttsd2si	%xmm0, %eax
	movl	%eax, (%rbx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB1_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
.LBB1_4:                                # %._crit_edge
	retq
.Lfunc_end1:
	.size	_Z12vecAleatoirePii, .Lfunc_end1-_Z12vecAleatoirePii
	.cfi_endproc
                                        # -- End function
	.globl	_Z7GPUInfov                     # -- Begin function _Z7GPUInfov
	.type	_Z7GPUInfov,@function
_Z7GPUInfov:                            # @_Z7GPUInfov
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$1480, %rsp                     # imm = 0x5C8
	.cfi_def_cfa_offset 1504
	.cfi_offset %rbx, -24
	.cfi_offset %rbp, -16
	leaq	4(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipGetDeviceCount
	movl	(%rbx), %eax
	testl	%eax, %eax
	jle	.LBB2_10
# %bb.1:                                # %.lr.ph
	leaq	8(%rsp), %rbx
	xorl	%ebp, %ebp
.LBB2_2:                                # =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	%ebp, %esi
	callq	hipGetDevicePropertiesR0600
	testl	%ebp, %ebp
	jne	.LBB2_9
# %bb.3:                                #   in Loop: Header=BB2_2 Depth=1
	cmpl	$9999, 368(%rsp)                # imm = 0x270F
	jne	.LBB2_6
# %bb.4:                                #   in Loop: Header=BB2_2 Depth=1
	cmpl	$9999, 372(%rsp)                # imm = 0x270F
	je	.LBB2_5
.LBB2_6:                                #   in Loop: Header=BB2_2 Depth=1
	movl	4(%rsp), %esi
	cmpl	$1, %esi
	jne	.LBB2_8
# %bb.7:                                #   in Loop: Header=BB2_2 Depth=1
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$.L.str.12, %edi
	xorl	%esi, %esi
	movq	%rbx, %rdx
	xorl	%eax, %eax
	callq	printf
	movl	368(%rsp), %esi
	movl	372(%rsp), %edx
	movl	$.L.str.13, %edi
	xorl	%eax, %eax
	callq	printf
	movq	296(%rsp), %rsi
	movl	$.L.str.14, %edi
	xorl	%eax, %eax
	callq	printf
	movq	304(%rsp), %rsi
	movl	$.L.str.15, %edi
	xorl	%eax, %eax
	callq	printf
	movl	316(%rsp), %esi
	movl	$.L.str.16, %edi
	xorl	%eax, %eax
	callq	printf
	movl	720(%rsp), %esi
	movl	$.L.str.17, %edi
	xorl	%eax, %eax
	callq	printf
	movl	632(%rsp), %esi
	movl	$.L.str.18, %edi
	xorl	%eax, %eax
	callq	printf
	movl	344(%rsp), %esi
	movl	348(%rsp), %edx
	movl	352(%rsp), %ecx
	movl	$.L.str.19, %edi
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB2_9
.LBB2_8:                                #   in Loop: Header=BB2_2 Depth=1
	movl	$.L.str.20, %edi
	xorl	%eax, %eax
	callq	printf
.LBB2_9:                                #   in Loop: Header=BB2_2 Depth=1
	incl	%ebp
	movl	4(%rsp), %eax
	cmpl	%eax, %ebp
	jl	.LBB2_2
	jmp	.LBB2_10
.LBB2_5:                                # %.critedge
	movl	$.L.str.10, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$-1, %eax
.LBB2_10:                               # %.loopexit
	addq	$1480, %rsp                     # imm = 0x5C8
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z7GPUInfov, .Lfunc_end2-_Z7GPUInfov
	.cfi_endproc
                                        # -- End function
	.globl	_Z6somCPUPii                    # -- Begin function _Z6somCPUPii
	.type	_Z6somCPUPii,@function
_Z6somCPUPii:                           # @_Z6somCPUPii
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB3_1
# %bb.3:                                # %.lr.ph.preheader
	movl	%esi, %ecx
	xorl	%edx, %edx
	xorl	%eax, %eax
.LBB3_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	addl	(%rdi,%rdx,4), %eax
	incq	%rdx
	cmpq	%rdx, %rcx
	jne	.LBB3_4
# %bb.2:                                # %._crit_edge
	retq
.LBB3_1:
	xorl	%eax, %eax
	retq
.Lfunc_end3:
	.size	_Z6somCPUPii, .Lfunc_end3-_Z6somCPUPii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z12somHypercubePii
.LCPI4_0:
	.quad	0x3ff0000000000000              # double 1
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI4_1:
	.long	0x3a800000                      # float 9.765625E-4
	.text
	.globl	_Z12somHypercubePii
	.type	_Z12somHypercubePii,@function
_Z12somHypercubePii:                    # @_Z12somHypercubePii
	.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	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebp
	movq	%rdi, %rbx
	movsd	.LCPI4_0(%rip), %xmm0           # xmm0 = mem[0],zero
	movl	%esi, %edi
	callq	ldexp@PLT
	cvttsd2si	%xmm0, %r15d
	leal	(%r15,%r15), %eax
	movslq	%eax, %r14
	shlq	$2, %r14
	movl	$0, 20(%rsp)
	leaq	24(%rsp), %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r14, %xmm0
	movss	.LCPI4_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm1, %xmm0
	mulss	%xmm1, %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str.4, %edi
	movq	%r14, %rsi
	movb	$1, %al
	callq	printf
	movq	%rsp, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_10
# %bb.1:
	movq	(%rsp), %rdi
	movq	%rbx, 32(%rsp)                  # 8-byte Spill
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leal	-1(%r15), %ebx
	leal	1022(%r15), %r12d
	testl	%ebx, %ebx
	cmovsl	%r12d, %ebx
	sarl	$10, %ebx
	incl	%ebx
	movl	$.L.str.6, %edi
	movl	%ebx, %esi
	movl	$1024, %edx                     # imm = 0x400
	xorl	%eax, %eax
	callq	printf
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	cmpl	$2047, %r12d                    # imm = 0x7FF
	jae	.LBB4_2
# %bb.7:
	movabsq	$4294968320, %rdx               # imm = 0x100000400
	leaq	-1023(%rdx), %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_9
# %bb.8:
	movq	(%rsp), %rdi
	movl	%ebp, %esi
	movl	%r15d, %edx
	callq	_Z33__device_stub__somHypercubeKernelPiii
	jmp	.LBB4_9
.LBB4_2:                                # %.preheader
	testl	%ebp, %ebp
	jle	.LBB4_9
# %bb.3:                                # %.lr.ph
	movabsq	$4294968320, %r12               # imm = 0x100000400
	movl	%ebx, %eax
	leaq	(%rax,%r12), %r13
	addq	$-1024, %r13                    # imm = 0xFC00
	xorl	%ebx, %ebx
.LBB4_4:                                # =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_6
# %bb.5:                                #   in Loop: Header=BB4_4 Depth=1
	movq	(%rsp), %rdi
	movl	%ebp, %esi
	movl	%ebx, %edx
	movl	%r15d, %ecx
	callq	_Z45__device_stub__somHypercubeUneDimensionKernelPiiii
.LBB4_6:                                #   in Loop: Header=BB4_4 Depth=1
	callq	hipDeviceSynchronize
	incl	%ebx
	cmpl	%ebx, %ebp
	jne	.LBB4_4
.LBB4_9:                                # %.loopexit
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	24(%rsp), %rsi
	movq	8(%rsp), %rdx
	leaq	20(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movq	(%rsp), %rsi
	movq	32(%rsp), %rdi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	(%rsp), %rdi
	callq	hipFree
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	addq	$40, %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
.LBB4_10:
	.cfi_def_cfa_offset 96
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$1, %edi
	callq	exit
.Lfunc_end4:
	.size	_Z12somHypercubePii, .Lfunc_end4-_Z12somHypercubePii
	.cfi_endproc
                                        # -- End function
	.globl	_Z33__device_stub__somHypercubeKernelPiii # -- Begin function _Z33__device_stub__somHypercubeKernelPiii
	.type	_Z33__device_stub__somHypercubeKernelPiii,@function
_Z33__device_stub__somHypercubeKernelPiii: # @_Z33__device_stub__somHypercubeKernelPiii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$96, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	4(%rsp), %rcx
	movl	%esi, (%rcx)
	movq	%rsp, %rsi
	movl	%edx, (%rsi)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z18somHypercubeKernelPiii, %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_end5:
	.size	_Z33__device_stub__somHypercubeKernelPiii, .Lfunc_end5-_Z33__device_stub__somHypercubeKernelPiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z45__device_stub__somHypercubeUneDimensionKernelPiiii # -- Begin function _Z45__device_stub__somHypercubeUneDimensionKernelPiiii
	.type	_Z45__device_stub__somHypercubeUneDimensionKernelPiiii,@function
_Z45__device_stub__somHypercubeUneDimensionKernelPiiii: # @_Z45__device_stub__somHypercubeUneDimensionKernelPiiii
	.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	20(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%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	32(%rsp), %r12
	leaq	24(%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	$_Z30somHypercubeUneDimensionKernelPiiii, %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_end6:
	.size	_Z45__device_stub__somHypercubeUneDimensionKernelPiiii, .Lfunc_end6-_Z45__device_stub__somHypercubeUneDimensionKernelPiiii
	.cfi_endproc
                                        # -- End function
	.globl	_Z6voisinjj                     # -- Begin function _Z6voisinjj
	.type	_Z6voisinjj,@function
_Z6voisinjj:                            # @_Z6voisinjj
	.cfi_startproc
# %bb.0:
	movl	%edi, %eax
	btcl	%esi, %eax
	retq
.Lfunc_end7:
	.size	_Z6voisinjj, .Lfunc_end7-_Z6voisinjj
	.cfi_endproc
                                        # -- End function
	.globl	_Z6vecAffPii                    # -- Begin function _Z6vecAffPii
	.type	_Z6vecAffPii,@function
_Z6vecAffPii:                           # @_Z6vecAffPii
	.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	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movl	$91, %edi
	callq	putchar@PLT
	leal	-1(%r14), %ebp
	cmpl	$2, %r14d
	jl	.LBB8_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %r14d
	xorl	%r15d, %r15d
.LBB8_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rbx,%r15,4), %esi
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB8_2
.LBB8_3:                                # %._crit_edge
	movslq	%ebp, %rax
	movl	(%rbx,%rax,4), %esi
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.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	printf                          # TAILCALL
.Lfunc_end8:
	.size	_Z6vecAffPii, .Lfunc_end8-_Z6vecAffPii
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB9_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB9_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z18somHypercubeKernelPiii, %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	$_Z30somHypercubeUneDimensionKernelPiiii, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end9:
	.size	__hip_module_ctor, .Lfunc_end9-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB10_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB10_2:
	retq
.Lfunc_end10:
	.size	__hip_module_dtor, .Lfunc_end10-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"----\nHypercube de dimension %d, soit %d valeurs dans le vecteur (%f Mo).\n"
	.size	.L.str, 74

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Temps d'execution sur CPU : %f ms.\n"
	.size	.L.str.1, 36

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Temps d'execution sur GPU : %f ms.\n"
	.size	.L.str.2, 36

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"SommeCPU : %d, sommeGPU : %d (ecart GPU : %d)\n"
	.size	.L.str.3, 47

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Allocation de %ld octets (%f Mo) sur le GPU.\n"
	.size	.L.str.4, 46

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Appel du noyau <<<%d blocs, %d>>>.\n"
	.size	.L.str.6, 36

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

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

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

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"%f]"
	.size	.L.str.9, 4

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"No CUDA GPU has been detected"
	.size	.L.str.10, 30

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Device %d, name: %s\n"
	.size	.L.str.12, 21

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Computational Capabilities: %d.%d\n"
	.size	.L.str.13, 35

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Maximum global memory size: %ld bytes\n"
	.size	.L.str.14, 39

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Maximum shared memory size per block: %ld bytes\n"
	.size	.L.str.15, 49

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"Warp size: %d\n"
	.size	.L.str.16, 15

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"Maximum number of blocks per multiProcessor: %d\n"
	.size	.L.str.17, 49

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"Maximum number of threads per multiProcessor: %d\n"
	.size	.L.str.18, 50

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"Maximum grid size : %d x %d x %d blocks.\n"
	.size	.L.str.19, 42

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"There are %d devices supporting CUDA\n"
	.size	.L.str.20, 38

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z18somHypercubeKernelPiii"
	.size	.L__unnamed_1, 27

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z30somHypercubeUneDimensionKernelPiiii"
	.size	.L__unnamed_2, 40

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"There is 1 device supporting CUDA"
	.size	.Lstr, 34

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Pb allocation !!!"
	.size	.Lstr.1, 18

	.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__somHypercubeKernelPiii
	.addrsig_sym _Z45__device_stub__somHypercubeUneDimensionKernelPiiii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z18somHypercubeKernelPiii
	.addrsig_sym _Z30somHypercubeUneDimensionKernelPiiii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z18somHypercubeKernelPiii ; -- Begin function _Z18somHypercubeKernelPiii
	.globl	_Z18somHypercubeKernelPiii
	.p2align	8
	.type	_Z18somHypercubeKernelPiii,@function
_Z18somHypercubeKernelPiii:             ; @_Z18somHypercubeKernelPiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x1c
	s_load_b64 s[2:3], s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_cmp_gt_i32 s2, 0
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	s_cselect_b32 s5, -1, 0
	s_mov_b32 s4, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_gt_i32_e32 vcc_lo, s3, v1
	s_and_b32 s5, vcc_lo, s5
	s_and_saveexec_b32 s6, s5
	s_cbranch_execz .LBB0_3
; %bb.1:                                ; %.lr.ph.preheader
	s_load_b64 s[0:1], s[0:1], 0x0
.LBB0_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_bfe_i32 s5, s4, 0x10000
	s_lshl_b32 s6, 1, s4
	s_and_b32 s5, s5, s3
	s_delay_alu instid0(SALU_CYCLE_1)
	v_xad_u32 v2, s6, v1, s5
	v_add_nc_u32_e32 v4, s5, v1
	s_and_b32 s5, s4, 1
	s_add_i32 s4, s4, 1
	s_cmp_eq_u32 s5, 0
	v_ashrrev_i32_e32 v3, 31, v2
	v_ashrrev_i32_e32 v5, 31, v4
	s_cselect_b32 s5, s3, 0
	s_cmp_lg_u32 s2, s4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_lshlrev_b64 v[4:5], 2, v[4:5]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v2, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v4, vcc_lo, s0, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo
	s_clause 0x1
	global_load_b32 v0, v[2:3], off
	global_load_b32 v4, v[4:5], off
	v_add_nc_u32_e32 v2, s5, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v4, v0
	global_store_b32 v[2:3], v0, off
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB0_2
.LBB0_3:                                ; %.loopexit
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z18somHypercubeKernelPiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 6
		.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	_Z18somHypercubeKernelPiii, .Lfunc_end0-_Z18somHypercubeKernelPiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 292
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; 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	_Z30somHypercubeUneDimensionKernelPiiii ; -- Begin function _Z30somHypercubeUneDimensionKernelPiiii
	.globl	_Z30somHypercubeUneDimensionKernelPiiii
	.p2align	8
	.type	_Z30somHypercubeUneDimensionKernelPiiii,@function
_Z30somHypercubeUneDimensionKernelPiiii: ; @_Z30somHypercubeUneDimensionKernelPiiii
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x24
	s_load_b64 s[2:3], s[0:1], 0xc
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	s_mov_b32 s4, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_lshr_b32 s4, s2, 31
	s_load_b64 s[0:1], s[0:1], 0x0
	s_add_i32 s4, s2, s4
	s_lshl_b32 s5, 1, s2
	s_and_b32 s4, s4, -2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_sub_i32 s4, s2, s4
	s_add_i32 s2, s2, 1
	s_mul_i32 s4, s4, s3
	v_xad_u32 v2, v1, s5, s4
	v_add_nc_u32_e32 v4, s4, v1
	s_lshr_b32 s4, s2, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	s_add_i32 s4, s2, s4
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_ashrrev_i32_e32 v5, 31, v4
	s_and_b32 s4, s4, -2
	s_sub_i32 s2, s2, s4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_lshlrev_b64 v[4:5], 2, v[4:5]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v2, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v4, vcc_lo, s0, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo
	s_clause 0x1
	global_load_b32 v6, v[2:3], off
	global_load_b32 v4, v[4:5], off
	v_mad_u64_u32 v[2:3], null, s2, s3, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v2, v4, v6
	global_store_b32 v[0:1], v2, off
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB1_2:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z30somHypercubeUneDimensionKernelPiiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 7
		.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	_Z30somHypercubeUneDimensionKernelPiiii, .Lfunc_end1-_Z30somHypercubeUneDimensionKernelPiiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 296
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; 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
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z18somHypercubeKernelPiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z18somHypercubeKernelPiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z30somHypercubeUneDimensionKernelPiiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z30somHypercubeUneDimensionKernelPiiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
