 
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cuda_runtime.h>
 

// CUDA Kernel
__global__ void matrixMul( float* C, float* A, float* B, int TM)
{
   float cc;
   int k;
   // calcul des coordonnees du thread
   int i =  blockIdx.x;
   int j =  threadIdx.x;
 
   cc = 0.;
   // calcul de c[i][j]
   for(k=0;k<TM;k++){
      cc += A[i*TM+k] * B[k*TM+j];
   }
   C[i*TM+j] = cc;
}
 
 
/////////////////////////////////////////////////////////
// Programme main
/////////////////////////////////////////////////////////
 
int main(int argc, char** argv)
{
	int i, j, GRID_SIZE_X, BLOCK_SIZE_X;
	int TM=1024;
   int size = TM*TM*sizeof(float);
	cudaError_t cerror;

	if (argc>1) {
		 TM=atoi(argv[1]);
	}
	BLOCK_SIZE_X = TM; 
	GRID_SIZE_X = TM;
 
   // definiton de la grille et des blocs
   dim3 block(BLOCK_SIZE_X);
   dim3 grid(GRID_SIZE_X);

   // allocation des matrices sur CPU
   float *h_A, *h_B, *h_C ;

   h_A = (float*) malloc(size);
   h_B = (float*) malloc(size);
   h_C = (float*) malloc(size);


   
   // initialisation des matrices avec des valeurs permettant de verifier le resultat
   for(i = 0; i < TM; i++){
      for(j = 0; j < TM; j++){
      	h_A[i*TM+j] = 1.0;
      	h_B[i*TM+j] = 1.0;
		h_C[i*TM+j] = 0.0;

		if (i==j) {
			h_A[i*TM+j]=(float) (i+1);
			h_B[i*TM+j]=(float) (i+1);
		}
      }
   }

   // Pour mesurer le temps de calcul
   float tc, tt_cpuGpu, tt_gpuCpu;
   cudaEvent_t depart, arret,cpuGpuDebut, cpuGpuFin, gpuCpuDebut, gpuCpuFin;
   cudaEventCreate(&depart);
   cudaEventCreate(&arret);
   cudaEventCreate(&cpuGpuDebut);
   cudaEventCreate(&cpuGpuFin);
   cudaEventCreate(&gpuCpuDebut);
   cudaEventCreate(&gpuCpuFin);
   cudaEventRecord(depart,0);
   cudaEventRecord(cpuGpuDebut,0);
   cudaEventRecord(gpuCpuDebut,0);

   // allocation des matrices sur GPU
   float *d_A, *d_B, *d_C;
   cudaMalloc((void**) &d_A,size);
   cudaMalloc((void**) &d_B,size);
   cudaMalloc((void**) &d_C,size);
 
   // copie des matrives A et B depuis le CPU vers le GPU
   cudaMemcpy(d_A, h_A, size,cudaMemcpyHostToDevice);
   cudaMemcpy(d_B, h_B, size,cudaMemcpyHostToDevice);
      // Mesure du temps : transfert + calcul
   cudaEventRecord(cpuGpuFin,0);
   cudaEventSynchronize(cpuGpuFin);
   cudaEventElapsedTime(&tt_cpuGpu,cpuGpuDebut, cpuGpuFin);

   cudaEventDestroy(cpuGpuDebut);
   cudaEventDestroy(cpuGpuFin);
   printf("Transfert A,B de CPU vers GPU : %f seconde\n", tt_cpuGpu/1000.0);

   // lancement des threads
   matrixMul<<< grid, block >>>(d_C, d_A, d_B, TM);
 
   // Vérification en cas d'erreur
   cerror=cudaGetLastError(); 
   if ((int)cerror !=0) { 
     printf("Erreur appel kernel %d \n", (int) cerror);
     exit(cerror);
   }
   // copie de la matrive C depuis le GPU
   cudaMemcpy(h_C,d_C, size,cudaMemcpyDeviceToHost);
   // Mesure du temps : transfert + calcul
   cudaEventRecord(gpuCpuFin,0);
   cudaEventSynchronize(gpuCpuFin);
   cudaEventElapsedTime(&tt_gpuCpu,gpuCpuDebut, gpuCpuFin);

   cudaEventDestroy(gpuCpuDebut);
   cudaEventDestroy(gpuCpuFin);
   printf("Transfert C de GPU vers CPU : %f seconde\n", tt_gpuCpu/1000.0);


   // Mesure du temps : transfert + calcul
   cudaEventRecord(arret,0);
   cudaEventSynchronize(arret);
   cudaEventElapsedTime(&tc,depart, arret);

   cudaEventDestroy(depart);
   cudaEventDestroy(arret);
   printf("Temps consommé : %f seconde\n", tc/1000.0);

   // verification du resultat
  for(i = 0; i < TM; i++){
    for(j = 0; j < TM; j++){
	if ((i==j) && (h_C[i*TM+j] != (float)((i+1)*(i+1)+TM-1))) 	   	{
		printf("Erreur i: %d j: %d %f\n", i, j, h_C[i*TM+j] ); exit(1);
		}
		else if ((i!=j) && (h_C[i*TM+j] != (float)(i+j+TM))) 			{
			printf("Erreur i: %d j: %d\n", i, j);
			exit(1);
		}
      }
   } 

   // liberation de la memoire
   free(h_A);
   free(h_B);
   free(h_C);
   cudaFree(d_A);
   cudaFree(d_B);
   cudaFree(d_C);
 
}

	.file	"tmpxft_0023f177_00000000-6_mul_matG1B1_et_1.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2030:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z33__device_stub__Z9matrixMulPfS_S_iPfS_S_i
	.type	_Z33__device_stub__Z9matrixMulPfS_S_iPfS_S_i, @function
_Z33__device_stub__Z9matrixMulPfS_S_iPfS_S_i:
.LFB2052:
	.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	.L2
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z9matrixMulPfS_S_i(%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
.L2:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2052:
	.size	_Z33__device_stub__Z9matrixMulPfS_S_iPfS_S_i, .-_Z33__device_stub__Z9matrixMulPfS_S_iPfS_S_i
	.globl	_Z9matrixMulPfS_S_i
	.type	_Z9matrixMulPfS_S_i, @function
_Z9matrixMulPfS_S_i:
.LFB2053:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z9matrixMulPfS_S_iPfS_S_i
	.cfi_endproc
.LFE2053:
	.size	_Z9matrixMulPfS_S_i, .-_Z9matrixMulPfS_S_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"Transfert A,B de CPU vers GPU : %f seconde\n"
.LC3:
	.string	"Erreur appel kernel %d \n"
.LC4:
	.string	"Transfert C de GPU vers CPU : %f seconde\n"
.LC5:
	.string	"Temps consomm\303\251 : %f seconde\n"
.LC6:
	.string	"Erreur i: %d j: %d %f\n"
.LC7:
	.string	"Erreur i: %d j: %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	$1024, %ebx
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	decl	%edi
	jle	.L9
	movq	8(%rsi), %rdi
	call	atoi@PLT
	movl	%eax, %ebx
.L9:
	movabsq	$4294967297, %rax
	movl	$4194304, %edi
	movl	%ebx, 96(%rsp)
	movq	%rax, 100(%rsp)
	movl	%ebx, 108(%rsp)
	movq	%rax, 112(%rsp)
	call	malloc@PLT
	movl	$4194304, %edi
	movq	%rax, %r14
	call	malloc@PLT
	movl	$4194304, %edi
	movq	%rax, %r13
	call	malloc@PLT
	movslq	%ebx, %r9
	xorl	%r8d, %r8d
	xorl	%esi, %esi
	movq	%rax, %r12
	movss	.LC0(%rip), %xmm0
	leal	-1(%rbx), %eax
	salq	$2, %r9
	movq	%rax, %r15
	leaq	4(,%rax,4), %r10
	xorl	%eax, %eax
.L10:
	cmpl	%ebx, %esi
	jge	.L36
	movq	%r8, %rdx
	xorl	%ecx, %ecx
	leal	1(%rsi), %edi
.L12:
	movss	%xmm0, (%r14,%rdx)
	movss	%xmm0, 0(%r13,%rdx)
	cmpl	%ecx, %esi
	je	.L11
.L14:
	incl	%ecx
	addq	$4, %rdx
	cmpl	%ecx, %ebx
	jne	.L12
	leaq	(%r12,%r8), %rdx
	movq	%r10, %rcx
	incl	%esi
	addq	%r9, %r8
	movq	%rdx, %rdi
	rep stosb
	jmp	.L10
.L11:
	cvtsi2ssl	%edi, %xmm1
	movss	%xmm1, (%r14,%rdx)
	movss	%xmm1, 0(%r13,%rdx)
	jmp	.L14
.L36:
	leaq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	40(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	48(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	56(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	64(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	leaq	72(%rsp), %rdi
	movl	$4194304, %esi
	call	cudaMalloc@PLT
	leaq	80(%rsp), %rdi
	movl	$4194304, %esi
	call	cudaMalloc@PLT
	leaq	88(%rsp), %rdi
	movl	$4194304, %esi
	call	cudaMalloc@PLT
	movq	72(%rsp), %rdi
	movl	$1, %ecx
	movq	%r14, %rsi
	movl	$4194304, %edx
	call	cudaMemcpy@PLT
	movq	80(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rsi
	movl	$4194304, %edx
	call	cudaMemcpy@PLT
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	48(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rsi
	leaq	16(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	40(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	48(%rsp), %rdi
	call	cudaEventDestroy@PLT
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	16(%rsp), %xmm0
	divsd	.LC1(%rip), %xmm0
	call	__printf_chk@PLT
	movl	104(%rsp), %ecx
	movq	96(%rsp), %rdx
	movq	108(%rsp), %rdi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	116(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L15
	movq	80(%rsp), %rdx
	movq	72(%rsp), %rsi
	movl	%ebx, %ecx
	movq	88(%rsp), %rdi
	call	_Z33__device_stub__Z9matrixMulPfS_S_iPfS_S_i
.L15:
	call	cudaGetLastError@PLT
	movl	%eax, %ebp
	testl	%eax, %eax
	je	.L16
	movl	%eax, %edx
	movl	$2, %edi
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	%ebp, %edi
	jmp	.L34
.L16:
	movq	88(%rsp), %rsi
	movl	$2, %ecx
	movl	$4194304, %edx
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	64(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	64(%rsp), %rdx
	movq	56(%rsp), %rsi
	leaq	20(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	56(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	64(%rsp), %rdi
	call	cudaEventDestroy@PLT
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	20(%rsp), %xmm0
	divsd	.LC1(%rip), %xmm0
	call	__printf_chk@PLT
	xorl	%esi, %esi
	movq	32(%rsp), %rdi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	leaq	12(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	24(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	12(%rsp), %xmm0
	divsd	.LC1(%rip), %xmm0
	call	__printf_chk@PLT
	xorl	%edx, %edx
	jmp	.L17
.L38:
	jne	.L27
.L19:
	incl	%ecx
	addq	$4, %rsi
	cmpl	%ecx, %ebx
	jne	.L22
	movl	%eax, %edx
	addl	%ebx, %ebp
.L17:
	cmpl	%ebx, %edx
	jge	.L37
	leal	1(%rdx), %eax
	movslq	%ebp, %rcx
	leal	(%rbx,%rdx), %r8d
	movl	%eax, %edi
	leaq	(%r12,%rcx,4), %rsi
	xorl	%ecx, %ecx
	imull	%eax, %edi
	addl	%r15d, %edi
.L22:
	movss	(%rsi), %xmm0
	cmpl	%edx, %ecx
	jne	.L18
	cvtsi2ssl	%edi, %xmm1
	ucomiss	%xmm0, %xmm1
	jnp	.L38
.L27:
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
.L35:
	movl	$1, %edi
.L34:
	call	exit@PLT
.L18:
	leal	(%r8,%rcx), %r9d
	cvtsi2ssl	%r9d, %xmm1
	ucomiss	%xmm0, %xmm1
	jp	.L28
	je	.L19
.L28:
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L35
.L37:
	movq	%r14, %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	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
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC8:
	.string	"_Z9matrixMulPfS_S_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2055:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC8(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z9matrixMulPfS_S_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2055:
	.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.cst4,"aM",@progbits,4
	.align 4
.LC0:
	.long	1065353216
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.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 <stdlib.h>
#include <math.h>
#include <hip/hip_runtime.h>
 

// CUDA Kernel
__global__ void matrixMul( float* C, float* A, float* B, int TM)
{
   float cc;
   int k;
   // calcul des coordonnees du thread
   int i =  blockIdx.x;
   int j =  threadIdx.x;
 
   cc = 0.;
   // calcul de c[i][j]
   for(k=0;k<TM;k++){
      cc += A[i*TM+k] * B[k*TM+j];
   }
   C[i*TM+j] = cc;
}
 
 
/////////////////////////////////////////////////////////
// Programme main
/////////////////////////////////////////////////////////
 
int main(int argc, char** argv)
{
	int i, j, GRID_SIZE_X, BLOCK_SIZE_X;
	int TM=1024;
   int size = TM*TM*sizeof(float);
	hipError_t cerror;

	if (argc>1) {
		 TM=atoi(argv[1]);
	}
	BLOCK_SIZE_X = TM; 
	GRID_SIZE_X = TM;
 
   // definiton de la grille et des blocs
   dim3 block(BLOCK_SIZE_X);
   dim3 grid(GRID_SIZE_X);

   // allocation des matrices sur CPU
   float *h_A, *h_B, *h_C ;

   h_A = (float*) malloc(size);
   h_B = (float*) malloc(size);
   h_C = (float*) malloc(size);


   
   // initialisation des matrices avec des valeurs permettant de verifier le resultat
   for(i = 0; i < TM; i++){
      for(j = 0; j < TM; j++){
      	h_A[i*TM+j] = 1.0;
      	h_B[i*TM+j] = 1.0;
		h_C[i*TM+j] = 0.0;

		if (i==j) {
			h_A[i*TM+j]=(float) (i+1);
			h_B[i*TM+j]=(float) (i+1);
		}
      }
   }

   // Pour mesurer le temps de calcul
   float tc, tt_cpuGpu, tt_gpuCpu;
   hipEvent_t depart, arret,cpuGpuDebut, cpuGpuFin, gpuCpuDebut, gpuCpuFin;
   hipEventCreate(&depart);
   hipEventCreate(&arret);
   hipEventCreate(&cpuGpuDebut);
   hipEventCreate(&cpuGpuFin);
   hipEventCreate(&gpuCpuDebut);
   hipEventCreate(&gpuCpuFin);
   hipEventRecord(depart,0);
   hipEventRecord(cpuGpuDebut,0);
   hipEventRecord(gpuCpuDebut,0);

   // allocation des matrices sur GPU
   float *d_A, *d_B, *d_C;
   hipMalloc((void**) &d_A,size);
   hipMalloc((void**) &d_B,size);
   hipMalloc((void**) &d_C,size);
 
   // copie des matrives A et B depuis le CPU vers le GPU
   hipMemcpy(d_A, h_A, size,hipMemcpyHostToDevice);
   hipMemcpy(d_B, h_B, size,hipMemcpyHostToDevice);
      // Mesure du temps : transfert + calcul
   hipEventRecord(cpuGpuFin,0);
   hipEventSynchronize(cpuGpuFin);
   hipEventElapsedTime(&tt_cpuGpu,cpuGpuDebut, cpuGpuFin);

   hipEventDestroy(cpuGpuDebut);
   hipEventDestroy(cpuGpuFin);
   printf("Transfert A,B de CPU vers GPU : %f seconde\n", tt_cpuGpu/1000.0);

   // lancement des threads
   matrixMul<<< grid, block >>>(d_C, d_A, d_B, TM);
 
   // Vérification en cas d'erreur
   cerror=hipGetLastError(); 
   if ((int)cerror !=0) { 
     printf("Erreur appel kernel %d \n", (int) cerror);
     exit(cerror);
   }
   // copie de la matrive C depuis le GPU
   hipMemcpy(h_C,d_C, size,hipMemcpyDeviceToHost);
   // Mesure du temps : transfert + calcul
   hipEventRecord(gpuCpuFin,0);
   hipEventSynchronize(gpuCpuFin);
   hipEventElapsedTime(&tt_gpuCpu,gpuCpuDebut, gpuCpuFin);

   hipEventDestroy(gpuCpuDebut);
   hipEventDestroy(gpuCpuFin);
   printf("Transfert C de GPU vers CPU : %f seconde\n", tt_gpuCpu/1000.0);


   // Mesure du temps : transfert + calcul
   hipEventRecord(arret,0);
   hipEventSynchronize(arret);
   hipEventElapsedTime(&tc,depart, arret);

   hipEventDestroy(depart);
   hipEventDestroy(arret);
   printf("Temps consommé : %f seconde\n", tc/1000.0);

   // verification du resultat
  for(i = 0; i < TM; i++){
    for(j = 0; j < TM; j++){
	if ((i==j) && (h_C[i*TM+j] != (float)((i+1)*(i+1)+TM-1))) 	   	{
		printf("Erreur i: %d j: %d %f\n", i, j, h_C[i*TM+j] ); exit(1);
		}
		else if ((i!=j) && (h_C[i*TM+j] != (float)(i+j+TM))) 			{
			printf("Erreur i: %d j: %d\n", i, j);
			exit(1);
		}
      }
   } 

   // liberation de la memoire
   free(h_A);
   free(h_B);
   free(h_C);
   hipFree(d_A);
   hipFree(d_B);
   hipFree(d_C);
 
}

	.text
	.file	"mul_matG1B1_et_1.hip"
	.globl	_Z24__device_stub__matrixMulPfS_S_i # -- Begin function _Z24__device_stub__matrixMulPfS_S_i
	.type	_Z24__device_stub__matrixMulPfS_S_i,@function
_Z24__device_stub__matrixMulPfS_S_i:    # @_Z24__device_stub__matrixMulPfS_S_i
	.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	$_Z9matrixMulPfS_S_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z24__device_stub__matrixMulPfS_S_i, .Lfunc_end0-_Z24__device_stub__matrixMulPfS_S_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI1_0:
	.quad	0x408f400000000000              # double 1000
	.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	$152, %rsp
	.cfi_def_cfa_offset 208
	.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	$1024, %ebp                     # imm = 0x400
	cmpl	$2, %edi
	jl	.LBB1_2
# %bb.1:
	movq	8(%rsi), %rdi
	callq	atoi
	movl	%eax, %ebp
.LBB1_2:
	movl	%ebp, %ebx
	movq	%rbx, %rax
	btsq	$32, %rax
	movq	%rax, 96(%rsp)                  # 8-byte Spill
	movl	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movl	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	movl	$4194304, %edi                  # imm = 0x400000
	callq	malloc
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	testl	%ebp, %ebp
	jle	.LBB1_9
# %bb.3:                                # %.preheader104.lr.ph
	leaq	(,%rbx,4), %rax
	movq	%rax, 104(%rsp)                 # 8-byte Spill
	xorl	%r13d, %r13d
	movl	$1065353216, %r14d              # imm = 0x3F800000
	xorl	%r15d, %r15d
.LBB1_4:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_5 Depth 2
	movl	%r13d, %eax
	movq	24(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %r12
	movq	32(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %rbp
	movl	%ebx, %eax
	imull	%r15d, %eax
	movq	56(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %rdi
	leaq	1(%r15), %rax
	movq	%rax, 112(%rsp)                 # 8-byte Spill
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, 52(%rsp)                 # 4-byte Spill
	xorl	%esi, %esi
	movq	104(%rsp), %rdx                 # 8-byte Reload
	callq	memset@PLT
	xorl	%eax, %eax
.LBB1_5:                                #   Parent Loop BB1_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	%r14d, (%rbp,%rax,4)
	movl	%r14d, (%r12,%rax,4)
	cmpq	%rax, %r15
	jne	.LBB1_7
# %bb.6:                                #   in Loop: Header=BB1_5 Depth=2
	movss	52(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%rbp,%rax,4)
	movss	%xmm0, (%r12,%rax,4)
.LBB1_7:                                #   in Loop: Header=BB1_5 Depth=2
	incq	%rax
	cmpq	%rax, %rbx
	jne	.LBB1_5
# %bb.8:                                # %._crit_edge
                                        #   in Loop: Header=BB1_4 Depth=1
	addl	%ebx, %r13d
	movq	112(%rsp), %rax                 # 8-byte Reload
	movq	%rax, %r15
	cmpq	%rbx, %rax
	jne	.LBB1_4
.LBB1_9:                                # %._crit_edge111
	leaq	88(%rsp), %r13
	movq	%r13, %rdi
	callq	hipEventCreate
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
	leaq	144(%rsp), %r14
	movq	%r14, %rdi
	callq	hipEventCreate
	leaq	136(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventCreate
	leaq	80(%rsp), %rbp
	movq	%rbp, %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	movq	(%r13), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r14), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rbp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	leaq	72(%rsp), %r13
	movl	$4194304, %esi                  # imm = 0x400000
	movq	%r13, %rdi
	callq	hipMalloc
	leaq	64(%rsp), %rbp
	movl	$4194304, %esi                  # imm = 0x400000
	movq	%rbp, %rdi
	callq	hipMalloc
	leaq	40(%rsp), %rdi
	movl	$4194304, %esi                  # imm = 0x400000
	callq	hipMalloc
	movq	(%r13), %rdi
	movl	$4194304, %edx                  # imm = 0x400000
	movq	32(%rsp), %rsi                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%rbp), %rdi
	movl	$4194304, %edx                  # imm = 0x400000
	movq	24(%rsp), %rsi                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r15), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r15), %rdi
	callq	hipEventSynchronize
	movq	(%r14), %rsi
	movq	(%r15), %rdx
	leaq	128(%rsp), %r13
	movq	%r13, %rdi
	callq	hipEventElapsedTime
	movq	(%r14), %rdi
	callq	hipEventDestroy
	movq	(%r15), %rdi
	callq	hipEventDestroy
	cvtss2sd	(%r13), %xmm0
	divsd	.LCPI1_0(%rip), %xmm0
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	movq	96(%rsp), %rdi                  # 8-byte Reload
	movl	$1, %esi
	movq	%rdi, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_11
# %bb.10:
	movq	40(%rsp), %rdi
	movq	72(%rsp), %rsi
	movq	64(%rsp), %rdx
	movl	%ebx, %ecx
	callq	_Z24__device_stub__matrixMulPfS_S_i
.LBB1_11:
	callq	hipGetLastError
	testl	%eax, %eax
	movq	56(%rsp), %r15                  # 8-byte Reload
	jne	.LBB1_24
# %bb.12:
	movq	40(%rsp), %rsi
	movl	$4194304, %edx                  # imm = 0x400000
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	xorl	%ebp, %ebp
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	8(%rsp), %rdi
	callq	hipEventSynchronize
	movq	80(%rsp), %rsi
	movq	8(%rsp), %rdx
	leaq	124(%rsp), %r13
	movq	%r13, %rdi
	callq	hipEventElapsedTime
	movq	80(%rsp), %rdi
	callq	hipEventDestroy
	movq	8(%rsp), %rdi
	callq	hipEventDestroy
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13), %xmm0
	divsd	.LCPI1_0(%rip), %xmm0
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	16(%rsp), %rdi
	callq	hipEventSynchronize
	movq	88(%rsp), %rsi
	movq	16(%rsp), %rdx
	leaq	132(%rsp), %r13
	movq	%r13, %rdi
	callq	hipEventElapsedTime
	movq	88(%rsp), %rdi
	callq	hipEventDestroy
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13), %xmm0
	divsd	.LCPI1_0(%rip), %xmm0
	movl	$.L.str.3, %edi
	movb	$1, %al
	callq	printf
	testl	%ebx, %ebx
	jle	.LBB1_20
# %bb.13:                               # %.preheader.lr.ph
	leal	-1(%rbx), %eax
	movq	%rbx, %rcx
	xorl	%edi, %edi
	xorl	%esi, %esi
.LBB1_14:                               # %.lr.ph113
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_15 Depth 2
	movl	%ebp, %edx
	leaq	(%r15,%rdx,4), %r9
	leaq	1(%rsi), %r8
	movl	%r8d, %edx
	imull	%r8d, %edx
	addl	%eax, %edx
	xorps	%xmm0, %xmm0
	cvtsi2ss	%edx, %xmm0
	movl	%ebx, %r10d
	imull	%esi, %r10d
	leaq	(%r15,%rsi,4), %r11
	xorl	%edx, %edx
.LBB1_15:                               #   Parent Loop BB1_14 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%rdi, %r14
	addq	%rdx, %r14
	je	.LBB1_17
# %bb.16:                               #   in Loop: Header=BB1_15 Depth=2
	leal	(%rcx,%rdx), %r14d
	xorps	%xmm1, %xmm1
	cvtsi2ss	%r14d, %xmm1
	movss	(%r9,%rdx,4), %xmm2             # xmm2 = mem[0],zero,zero,zero
	ucomiss	%xmm1, %xmm2
	jne	.LBB1_21
	jnp	.LBB1_18
	jmp	.LBB1_21
.LBB1_17:                               #   in Loop: Header=BB1_15 Depth=2
	movss	(%r11,%r10,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm0, %xmm1
	jne	.LBB1_22
	jp	.LBB1_22
.LBB1_18:                               # %.thread
                                        #   in Loop: Header=BB1_15 Depth=2
	incq	%rdx
	cmpq	%rdx, %rbx
	jne	.LBB1_15
# %bb.19:                               # %._crit_edge114
                                        #   in Loop: Header=BB1_14 Depth=1
	addl	%ebx, %ebp
	decq	%rdi
	incq	%rcx
	movq	%r8, %rsi
	cmpq	%rbx, %r8
	jne	.LBB1_14
.LBB1_20:                               # %._crit_edge116
	movq	32(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	24(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	72(%rsp), %rdi
	callq	hipFree
	movq	64(%rsp), %rdi
	callq	hipFree
	movq	40(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$152, %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
.LBB1_21:
	.cfi_def_cfa_offset 208
	movl	$.L.str.5, %edi
                                        # kill: def $esi killed $esi killed $rsi
                                        # kill: def $edx killed $edx killed $rdx
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB1_23
.LBB1_22:
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm0
	movl	$.L.str.4, %edi
	movl	%esi, %edx
	movb	$1, %al
	callq	printf
.LBB1_23:
	movl	$1, %edi
	callq	exit
.LBB1_24:
	movl	%eax, %ebp
	movl	$.L.str.1, %edi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	printf
	movl	%ebp, %edi
	callq	exit
.Lfunc_end1:
	.size	main, .Lfunc_end1-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:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB2_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB2_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9matrixMulPfS_S_i, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end2:
	.size	__hip_module_ctor, .Lfunc_end2-__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	.LBB3_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
.LBB3_2:
	retq
.Lfunc_end3:
	.size	__hip_module_dtor, .Lfunc_end3-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z9matrixMulPfS_S_i,@object     # @_Z9matrixMulPfS_S_i
	.section	.rodata,"a",@progbits
	.globl	_Z9matrixMulPfS_S_i
	.p2align	3, 0x0
_Z9matrixMulPfS_S_i:
	.quad	_Z24__device_stub__matrixMulPfS_S_i
	.size	_Z9matrixMulPfS_S_i, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Transfert A,B de CPU vers GPU : %f seconde\n"
	.size	.L.str, 44

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Erreur appel kernel %d \n"
	.size	.L.str.1, 25

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Transfert C de GPU vers CPU : %f seconde\n"
	.size	.L.str.2, 42

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Temps consomm\303\251 : %f seconde\n"
	.size	.L.str.3, 30

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Erreur i: %d j: %d %f\n"
	.size	.L.str.4, 23

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Erreur i: %d j: %d\n"
	.size	.L.str.5, 20

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

	.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 _Z24__device_stub__matrixMulPfS_S_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z9matrixMulPfS_S_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9matrixMulPfS_S_i     ; -- Begin function _Z9matrixMulPfS_S_i
	.globl	_Z9matrixMulPfS_S_i
	.p2align	8
	.type	_Z9matrixMulPfS_S_i,@function
_Z9matrixMulPfS_S_i:                    ; @_Z9matrixMulPfS_S_i
; %bb.0:
	s_clause 0x2
	s_load_b32 s8, s[0:1], 0x18
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s8, 1
	s_mul_i32 s0, s15, s8
	s_cbranch_scc1 .LBB0_3
; %bb.1:                                ; %.lr.ph.preheader
	v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v1, v0
	s_ashr_i32 s1, s0, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_lshl_b64 s[10:11], s[0:1], 2
	v_mov_b32_e32 v3, v2
	s_add_u32 s6, s6, s10
	s_addc_u32 s7, s7, s11
	s_mov_b32 s1, s8
.LBB0_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	s_load_b32 s9, s[6:7], 0x0
	s_add_i32 s1, s1, -1
	v_add_nc_u32_e32 v1, s8, v1
	s_add_u32 s6, s6, 4
	s_addc_u32 s7, s7, 0
	v_add_co_u32 v4, vcc_lo, s2, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s3, v5, vcc_lo
	s_cmp_lg_u32 s1, 0
	global_load_b32 v4, v[4:5], off
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_fmac_f32_e32 v3, s9, v4
	s_cbranch_scc1 .LBB0_2
	s_branch .LBB0_4
.LBB0_3:
	v_mov_b32_e32 v3, 0
.LBB0_4:                                ; %._crit_edge
	v_add_nc_u32_e32 v0, s0, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v1, 31, v0
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_store_b32 v[0:1], v3, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9matrixMulPfS_S_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 28
		.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	_Z9matrixMulPfS_S_i, .Lfunc_end0-_Z9matrixMulPfS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 212
; 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
	.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
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 28
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9matrixMulPfS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9matrixMulPfS_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
