#include <iostream>
#include <cstdio>

#define BLOCK_SIZE 16
#define SIZE_RATE 200

struct matrix{
  int height;
  int width;
  float *elements;
};

void printMatrix(matrix M){
  for(int i = 0; i < M.height; i++){
    for(int j = 0; j < M.width; j++){
      if(j != 0) std::cout << " ";
      std::cout << M.elements[i*M.width+j];
    }
    std::cout << std::endl;
  }
  std::cout << std::endl;
}

__global__ void matrixMul(matrix A, matrix B, matrix C){
  //行列Cにおけるどこを計算するスレッドか確定する。
  int row = blockIdx.y*blockDim.y + threadIdx.y;
  int col = blockIdx.x*blockDim.x + threadIdx.x;

  //計算が必要なスレッドか確認
  if(row < C.height && col < C.width){
    float x = 0.0f;
    for (int i = 0; i < A.width; i++) {
      x += A.elements[row*A.width+i]*B.elements[i*B.width+col];
    }

    C.elements[row*C.width+col] = x;
  }
}

matrix matrixMul_gpu(matrix A, matrix B){
  matrix C;
  C.height = A.height;
  C.width = B.width;
  C.elements = new float[C.height*C.width];
  //デバイス要変数の用意
  matrix dA, dB, dC;
  dA.width = A.width; dA.height = A.height;
  dB.width = B.width; dB.height = B.height;
  dC.width = C.width; dC.height = C.height;

  int size;
  // デバイスメモリの確保とホストからの転送
  size = dA.width*dA.height*sizeof(float);
  cudaMalloc((void**)&dA.elements, size);
  cudaMemcpy(dA.elements, A.elements, size, cudaMemcpyHostToDevice);

  size = dB.width*dB.height*sizeof(float);
  cudaMalloc((void**)&dB.elements, size);
  cudaMemcpy(dB.elements, B.elements, size, cudaMemcpyHostToDevice);

  //Cは計算前なのでコピー不要
  size = dC.width*dC.height*sizeof(float);
  cudaMalloc((void**)&dC.elements, size);

  //Cのサイズに合わせてブロックとグリッドの設定
  dim3 blk(BLOCK_SIZE, BLOCK_SIZE);
  dim3 gld((C.width-1+blk.x)/blk.x, (C.height-1+blk.y)/blk.y);

  matrixMul<<<gld, blk>>>(dA, dB, dC);

  //sizeはそのまま
  cudaMemcpy(C.elements, dC.elements, size, cudaMemcpyDeviceToHost);

  //デバイスのメモリ解放
  cudaFree(dA.elements);
  cudaFree(dB.elements);
  cudaFree(dC.elements);
  return C;
}

matrix matrixMul_cpu(matrix A, matrix B){
  //計算結果行列の用意
  matrix C;
  C.height = A.height;
  C.width = B.width;
  C.elements = new float[C.height*C.width];

  for(int i = 0; i < C.height; i++){
    for(int j = 0; j < C.width; j++){
      float x = 0.0f;
      for (int k = 0; k < A.width; k++) {
        x += A.elements[i*A.width+k]*B.elements[k*B.width+j];
      }

      C.elements[i*C.width+j] = x;
    }
  }

  return C;
}

void randomInit(float* data, int size, float maxVal){
  for(int i = 0; i < size; i++){
    data[i] = maxVal*(rand()/(float)RAND_MAX);
  }
}

int main(){
  matrix A, B, C;
  A.height = A.width = SIZE_RATE*BLOCK_SIZE;
  B.height = B.width = SIZE_RATE*BLOCK_SIZE;

  A.elements = new float[A.width*A.height];
  B.elements = new float[B.width*B.height];

  randomInit(A.elements, A.width*A.height, 10);
  randomInit(B.elements, B.width*B.height, 10);

  //計測開始
  clock_t start = clock();
  C = matrixMul_cpu(A, B);
  //計測終了
  clock_t end = clock();
  double rate = (double)(end - start);
  std::cout << "cpuMultime = " << rate / CLOCKS_PER_SEC << "sec.\n";

  //計測開始
  start = clock();
  C = matrixMul_gpu(A, B);
  //計測終了
  end = clock();
  std::cout << "gpuMultime = " << (double)(end - start) / CLOCKS_PER_SEC << "sec.\n";
  std::cout << "rate = " << rate/((double)(end - start)) << std::endl;
  //printMatrix(A);
  //printMatrix(B);
  //printMatrix(C);

  // ホストメモリ解放
  delete [] A.elements;
  delete [] B.elements;
  delete [] C.elements;

  return 0;
}

	.file	"tmpxft_002a8f1e_00000000-6_matrix.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3642:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3642:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" "
	.text
	.globl	_Z11printMatrix6matrix
	.type	_Z11printMatrix6matrix, @function
_Z11printMatrix6matrix:
.LFB3635:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdi, %rax
	movq	%rsi, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	sarq	$32, %rax
	xorl	%r14d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%eax, 8(%rsp)
	movl	%eax, 12(%rsp)
.L3:
	cmpl	%r12d, %r14d
	jge	.L6
	movslq	%r13d, %rbx
	xorl	%ebp, %ebp
	salq	$2, %rbx
.L7:
	movl	8(%rsp), %eax
	cmpl	%eax, %ebp
	jge	.L13
	testl	%ebp, %ebp
	je	.L4
	leaq	.LC0(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L4:
	leaq	_ZSt4cout(%rip), %rdi
	cvtss2sd	(%rbx,%r15), %xmm0
	incl	%ebp
	addq	$4, %rbx
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	jmp	.L7
.L13:
	leaq	_ZSt4cout(%rip), %rdi
	incl	%r14d
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movl	12(%rsp), %eax
	addl	%eax, %r13d
	jmp	.L3
.L6:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	leaq	_ZSt4cout(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	.cfi_endproc
.LFE3635:
	.size	_Z11printMatrix6matrix, .-_Z11printMatrix6matrix
	.globl	_Z13matrixMul_cpu6matrixS_
	.type	_Z13matrixMul_cpu6matrixS_, @function
_Z13matrixMul_cpu6matrixS_:
.LFB3637:
	.cfi_startproc
	endbr64
	movabsq	$2305843009213693950, %rax
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	sarq	$32, %rdx
	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
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	sarq	$32, %r12
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movl	%edi, 12(%rsp)
	movl	%edx, %edi
	imull	%ebx, %edi
	movq	%rsi, 24(%rsp)
	movl	%r12d, 16(%rsp)
	movl	%edx, 20(%rsp)
	movslq	%edi, %rdi
	cmpq	%rdi, %rax
	jb	.L15
	salq	$2, %rdi
	movq	%rdx, %rbp
	movq	%rcx, %r13
	call	_Znam@PLT
	movl	%ebp, %r14d
	xorl	%esi, %esi
	xorl	%edi, %edi
	movq	%rax, %rdx
	leaq	0(,%rbp,4), %r15
	xorl	%r8d, %r8d
	jmp	.L16
.L15:
	call	__cxa_throw_bad_array_new_length@PLT
.L18:
	incl	%r8d
	addl	%r14d, %edi
	addl	%r12d, %esi
.L16:
	cmpl	%r8d, 12(%rsp)
	jle	.L20
	movslq	%edi, %rax
	movq	24(%rsp), %rcx
	leaq	(%rdx,%rax,4), %r11
	movslq	%esi, %rax
	leaq	(%rcx,%rax,4), %r10
	xorl	%eax, %eax
.L21:
	cmpl	%eax, 20(%rsp)
	jle	.L18
	leaq	0(%r13,%rax,4), %r9
	xorl	%ecx, %ecx
	xorps	%xmm0, %xmm0
.L19:
	cmpl	%ecx, 16(%rsp)
	jle	.L23
	movss	(%r10,%rcx,4), %xmm1
	mulss	(%r9), %xmm1
	incq	%rcx
	addq	%r15, %r9
	addss	%xmm1, %xmm0
	jmp	.L19
.L23:
	movss	%xmm0, (%r11,%rax,4)
	incq	%rax
	jmp	.L21
.L20:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	salq	$32, %rbp
	movl	%ebx, %eax
	orq	%rbp, %rax
	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
.LFE3637:
	.size	_Z13matrixMul_cpu6matrixS_, .-_Z13matrixMul_cpu6matrixS_
	.globl	_Z10randomInitPfif
	.type	_Z10randomInitPfif, @function
_Z10randomInitPfif:
.LFB3638:
	.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
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movss	%xmm0, 12(%rsp)
.L25:
	cmpl	%ebx, %ebp
	jle	.L28
	call	rand@PLT
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC2(%rip), %xmm0
	mulss	12(%rsp), %xmm0
	movss	%xmm0, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L25
.L28:
	addq	$16, %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
.LFE3638:
	.size	_Z10randomInitPfif, .-_Z10randomInitPfif
	.globl	_Z37__device_stub__Z9matrixMul6matrixS_S_R6matrixS0_S0_
	.type	_Z37__device_stub__Z9matrixMul6matrixS_S_R6matrixS0_S0_, @function
_Z37__device_stub__Z9matrixMul6matrixS_S_R6matrixS0_S0_:
.LFB3664:
	.cfi_startproc
	endbr64
	subq	$104, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rcx
	movq	%rdi, 64(%rsp)
	movabsq	$4294967297, %rax
	movq	%rsi, 72(%rsp)
	leaq	16(%rsp), %rdi
	leaq	28(%rsp), %rsi
	movq	%rdx, 80(%rsp)
	movq	%rsp, %rdx
	movq	%rax, 16(%rsp)
	movl	$1, 24(%rsp)
	movq	%rax, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L29
	pushq	8(%rsp)
	.cfi_def_cfa_offset 120
	leaq	_Z9matrixMul6matrixS_S_(%rip), %rdi
	pushq	8(%rsp)
	.cfi_def_cfa_offset 128
	movq	44(%rsp), %rcx
	movl	52(%rsp), %r8d
	movq	32(%rsp), %rsi
	movl	40(%rsp), %edx
	leaq	80(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 120
	popq	%rdx
	.cfi_def_cfa_offset 112
.L29:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	addq	$104, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3664:
	.size	_Z37__device_stub__Z9matrixMul6matrixS_S_R6matrixS0_S0_, .-_Z37__device_stub__Z9matrixMul6matrixS_S_R6matrixS0_S0_
	.globl	_Z9matrixMul6matrixS_S_
	.type	_Z9matrixMul6matrixS_S_, @function
_Z9matrixMul6matrixS_S_:
.LFB3665:
	.cfi_startproc
	endbr64
	subq	$56, %rsp
	.cfi_def_cfa_offset 64
	movq	%rdi, 32(%rsp)
	leaq	32(%rsp), %rdi
	movq	%rsi, 40(%rsp)
	leaq	16(%rsp), %rsi
	movq	%rdx, 16(%rsp)
	movq	%rsp, %rdx
	movq	%rcx, 24(%rsp)
	movq	%r8, (%rsp)
	movq	%r9, 8(%rsp)
	call	_Z37__device_stub__Z9matrixMul6matrixS_S_R6matrixS0_S0_
	addq	$56, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3665:
	.size	_Z9matrixMul6matrixS_S_, .-_Z9matrixMul6matrixS_S_
	.globl	_Z13matrixMul_gpu6matrixS_
	.type	_Z13matrixMul_gpu6matrixS_, @function
_Z13matrixMul_gpu6matrixS_:
.LFB3636:
	.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
	movq	%rdx, %r12
	sarq	$32, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	movl	%r12d, %edi
	imull	%ebx, %edi
	subq	$152, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	movslq	%edi, %rdi
	movq	%rdx, 8(%rsp)
	movabsq	$2305843009213693950, %rax
	cmpq	%rdi, %rax
	jb	.L36
	movq	%rbx, %rbp
	salq	$2, %rdi
	movq	%rcx, %r14
	movq	%rsi, %r15
	call	_Znam@PLT
	sarq	$32, %rbp
	movq	8(%rsp), %rdx
	leaq	48(%rsp), %rdi
	movl	%ebp, 44(%rsp)
	imull	%ebx, %ebp
	movq	%rax, %r13
	movl	%edx, 56(%rsp)
	movl	%ebx, 40(%rsp)
	sall	$2, %ebp
	movl	%r12d, 60(%rsp)
	movslq	%ebp, %rbp
	movl	%r12d, 76(%rsp)
	movq	%rbp, %rsi
	movl	%ebx, 72(%rsp)
	call	cudaMalloc@PLT
	movq	48(%rsp), %rdi
	movq	%rbp, %rdx
	movq	%r15, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	60(%rsp), %ebp
	imull	56(%rsp), %ebp
	leaq	64(%rsp), %rdi
	sall	$2, %ebp
	movslq	%ebp, %rbp
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movq	64(%rsp), %rdi
	movq	%rbp, %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	76(%rsp), %ebp
	imull	72(%rsp), %ebp
	leaq	80(%rsp), %rdi
	sall	$2, %ebp
	movslq	%ebp, %rbp
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	leal	15(%r12), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	shrl	$4, %eax
	movl	$1, %ecx
	movl	$1, %esi
	movabsq	$68719476752, %rdx
	movl	%eax, 28(%rsp)
	leal	15(%rbx), %eax
	shrl	$4, %eax
	movl	%eax, 32(%rsp)
	movq	28(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L37
	movups	40(%rsp), %xmm0
	movups	56(%rsp), %xmm1
	leaq	120(%rsp), %rdx
	leaq	104(%rsp), %rsi
	movups	72(%rsp), %xmm2
	leaq	88(%rsp), %rdi
	movups	%xmm0, 88(%rsp)
	movups	%xmm1, 104(%rsp)
	movups	%xmm2, 120(%rsp)
	call	_Z37__device_stub__Z9matrixMul6matrixS_S_R6matrixS0_S0_
	jmp	.L37
.L36:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	call	__cxa_throw_bad_array_new_length@PLT
.L37:
	movq	80(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdx
	movq	%r13, %rdi
	salq	$32, %r12
	call	cudaMemcpy@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movl	%ebx, %eax
	orq	%r12, %rax
	movq	136(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L40
.L43:
	call	__stack_chk_fail@PLT
.L40:
	addq	$152, %rsp
	.cfi_def_cfa_offset 56
	movq	%r13, %rdx
	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
.LFE3636:
	.size	_Z13matrixMul_gpu6matrixS_, .-_Z13matrixMul_gpu6matrixS_
	.section	.rodata.str1.1
.LC4:
	.string	"cpuMultime = "
.LC6:
	.string	"sec.\n"
.LC7:
	.string	"gpuMultime = "
.LC8:
	.string	"rate = "
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3639:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$40960000, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC6(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movabsq	$13743895350400, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	call	_Znam@PLT
	movl	$40960000, %edi
	movq	%rax, %rbp
	call	_Znam@PLT
	movss	.LC3(%rip), %xmm0
	movl	$10240000, %esi
	movq	%rbp, %rdi
	movq	%rax, 8(%rsp)
	call	_Z10randomInitPfif
	movq	8(%rsp), %rdi
	movl	$10240000, %esi
	movss	.LC3(%rip), %xmm0
	call	_Z10randomInitPfif
	call	clock@PLT
	movq	8(%rsp), %rcx
	movq	%r12, %rdi
	movq	%rbp, %rsi
	movq	%r12, %rdx
	movq	%rax, %r13
	call	_Z13matrixMul_cpu6matrixS_
	call	clock@PLT
	leaq	.LC4(%rip), %rsi
	subq	%r13, %rax
	leaq	_ZSt4cout(%rip), %r13
	cvtsi2sdq	%rax, %xmm2
	movq	%r13, %rdi
	movsd	%xmm2, 16(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	16(%rsp), %xmm0
	divsd	.LC5(%rip), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	call	clock@PLT
	movq	8(%rsp), %rcx
	movq	%r12, %rdi
	movq	%rbp, %rsi
	movq	%r12, %rdx
	movq	%rax, %rbx
	call	_Z13matrixMul_gpu6matrixS_
	movq	%rdx, %r15
	call	clock@PLT
	leaq	.LC7(%rip), %rsi
	movq	%r13, %rdi
	movq	%rax, %r12
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	subq	%rbx, %r12
	cvtsi2sdq	%r12, %xmm1
	movq	%rax, %rdi
	movaps	%xmm1, %xmm0
	movsd	%xmm1, 24(%rsp)
	divsd	.LC5(%rip), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC8(%rip), %rsi
	movq	%r13, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	24(%rsp), %xmm1
	movsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	divsd	%xmm1, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movq	%rbp, %rdi
	call	_ZdaPv@PLT
	movq	8(%rsp), %rdi
	call	_ZdaPv@PLT
	testq	%r15, %r15
	je	.L45
	movq	%r15, %rdi
	call	_ZdaPv@PLT
.L45:
	addq	$40, %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
.LFE3639:
	.size	main, .-main
	.section	.rodata.str1.1
.LC9:
	.string	"_Z9matrixMul6matrixS_S_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3667:
	.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	.LC9(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z9matrixMul6matrixS_S_(%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
.LFE3667:
	.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
.LC2:
	.long	805306368
	.align 4
.LC3:
	.long	1092616192
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC5:
	.long	0
	.long	1093567616
	.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 <hip/hip_runtime.h>
#include <iostream>
#include <cstdio>

#define BLOCK_SIZE 16
#define SIZE_RATE 200

struct matrix{
  int height;
  int width;
  float *elements;
};

void printMatrix(matrix M){
  for(int i = 0; i < M.height; i++){
    for(int j = 0; j < M.width; j++){
      if(j != 0) std::cout << " ";
      std::cout << M.elements[i*M.width+j];
    }
    std::cout << std::endl;
  }
  std::cout << std::endl;
}

__global__ void matrixMul(matrix A, matrix B, matrix C){
  //行列Cにおけるどこを計算するスレッドか確定する。
  int row = blockIdx.y*blockDim.y + threadIdx.y;
  int col = blockIdx.x*blockDim.x + threadIdx.x;

  //計算が必要なスレッドか確認
  if(row < C.height && col < C.width){
    float x = 0.0f;
    for (int i = 0; i < A.width; i++) {
      x += A.elements[row*A.width+i]*B.elements[i*B.width+col];
    }

    C.elements[row*C.width+col] = x;
  }
}

matrix matrixMul_gpu(matrix A, matrix B){
  matrix C;
  C.height = A.height;
  C.width = B.width;
  C.elements = new float[C.height*C.width];
  //デバイス要変数の用意
  matrix dA, dB, dC;
  dA.width = A.width; dA.height = A.height;
  dB.width = B.width; dB.height = B.height;
  dC.width = C.width; dC.height = C.height;

  int size;
  // デバイスメモリの確保とホストからの転送
  size = dA.width*dA.height*sizeof(float);
  hipMalloc((void**)&dA.elements, size);
  hipMemcpy(dA.elements, A.elements, size, hipMemcpyHostToDevice);

  size = dB.width*dB.height*sizeof(float);
  hipMalloc((void**)&dB.elements, size);
  hipMemcpy(dB.elements, B.elements, size, hipMemcpyHostToDevice);

  //Cは計算前なのでコピー不要
  size = dC.width*dC.height*sizeof(float);
  hipMalloc((void**)&dC.elements, size);

  //Cのサイズに合わせてブロックとグリッドの設定
  dim3 blk(BLOCK_SIZE, BLOCK_SIZE);
  dim3 gld((C.width-1+blk.x)/blk.x, (C.height-1+blk.y)/blk.y);

  matrixMul<<<gld, blk>>>(dA, dB, dC);

  //sizeはそのまま
  hipMemcpy(C.elements, dC.elements, size, hipMemcpyDeviceToHost);

  //デバイスのメモリ解放
  hipFree(dA.elements);
  hipFree(dB.elements);
  hipFree(dC.elements);
  return C;
}

matrix matrixMul_cpu(matrix A, matrix B){
  //計算結果行列の用意
  matrix C;
  C.height = A.height;
  C.width = B.width;
  C.elements = new float[C.height*C.width];

  for(int i = 0; i < C.height; i++){
    for(int j = 0; j < C.width; j++){
      float x = 0.0f;
      for (int k = 0; k < A.width; k++) {
        x += A.elements[i*A.width+k]*B.elements[k*B.width+j];
      }

      C.elements[i*C.width+j] = x;
    }
  }

  return C;
}

void randomInit(float* data, int size, float maxVal){
  for(int i = 0; i < size; i++){
    data[i] = maxVal*(rand()/(float)RAND_MAX);
  }
}

int main(){
  matrix A, B, C;
  A.height = A.width = SIZE_RATE*BLOCK_SIZE;
  B.height = B.width = SIZE_RATE*BLOCK_SIZE;

  A.elements = new float[A.width*A.height];
  B.elements = new float[B.width*B.height];

  randomInit(A.elements, A.width*A.height, 10);
  randomInit(B.elements, B.width*B.height, 10);

  //計測開始
  clock_t start = clock();
  C = matrixMul_cpu(A, B);
  //計測終了
  clock_t end = clock();
  double rate = (double)(end - start);
  std::cout << "cpuMultime = " << rate / CLOCKS_PER_SEC << "sec.\n";

  //計測開始
  start = clock();
  C = matrixMul_gpu(A, B);
  //計測終了
  end = clock();
  std::cout << "gpuMultime = " << (double)(end - start) / CLOCKS_PER_SEC << "sec.\n";
  std::cout << "rate = " << rate/((double)(end - start)) << std::endl;
  //printMatrix(A);
  //printMatrix(B);
  //printMatrix(C);

  // ホストメモリ解放
  delete [] A.elements;
  delete [] B.elements;
  delete [] C.elements;

  return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z11printMatrix6matrix          # -- Begin function _Z11printMatrix6matrix
	.type	_Z11printMatrix6matrix,@function
_Z11printMatrix6matrix:                 # @_Z11printMatrix6matrix
	.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
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, (%rsp)                    # 8-byte Spill
	testl	%edi, %edi
	jle	.LBB0_8
# %bb.1:                                # %.preheader.lr.ph
	movq	%rdi, %r14
	shrq	$32, %r14
	movl	%edi, %r15d
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
.LBB0_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_4 Depth 2
	testl	%r14d, %r14d
	jle	.LBB0_7
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB0_2 Depth=1
	movl	%r12d, %eax
	movq	(%rsp), %rcx                    # 8-byte Reload
	leaq	(%rcx,%rax,4), %r13
	xorl	%ebx, %ebx
.LBB0_4:                                #   Parent Loop BB0_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	testq	%rbx, %rbx
	je	.LBB0_6
# %bb.5:                                #   in Loop: Header=BB0_4 Depth=2
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.LBB0_6:                                #   in Loop: Header=BB0_4 Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13,%rbx,4), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	incq	%rbx
	cmpq	%rbx, %r14
	jne	.LBB0_4
.LBB0_7:                                # %._crit_edge
                                        #   in Loop: Header=BB0_2 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	incq	%rbp
	addl	%r14d, %r12d
	cmpq	%r15, %rbp
	jne	.LBB0_2
.LBB0_8:                                # %._crit_edge11
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_ZNSo5flushEv                   # TAILCALL
.Lfunc_end0:
	.size	_Z11printMatrix6matrix, .Lfunc_end0-_Z11printMatrix6matrix
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__matrixMul6matrixS_S_ # -- Begin function _Z24__device_stub__matrixMul6matrixS_S_
	.type	_Z24__device_stub__matrixMul6matrixS_S_,@function
_Z24__device_stub__matrixMul6matrixS_S_: # @_Z24__device_stub__matrixMul6matrixS_S_
	.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	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	80(%rsp), %rax
	movq	%rdi, (%rax)
	movq	%rsi, 8(%rax)
	leaq	64(%rsp), %rsi
	movq	%rdx, (%rsi)
	movq	%rcx, 8(%rsi)
	leaq	48(%rsp), %rcx
	movq	%r8, (%rcx)
	movq	%r9, 8(%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rsi, 8(%rbx)
	movq	%rcx, 16(%rbx)
	leaq	32(%rsp), %r14
	leaq	16(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_Z9matrixMul6matrixS_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z24__device_stub__matrixMul6matrixS_S_, .Lfunc_end1-_Z24__device_stub__matrixMul6matrixS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z13matrixMul_gpu6matrixS_      # -- Begin function _Z13matrixMul_gpu6matrixS_
	.type	_Z13matrixMul_gpu6matrixS_,@function
_Z13matrixMul_gpu6matrixS_:             # @_Z13matrixMul_gpu6matrixS_
	.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	$72, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, 24(%rsp)                  # 8-byte Spill
	movq	%rdx, %rbp
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	movq	%rdi, %r14
	movq	%rdi, %r13
	shrq	$32, %r13
	movq	%rdx, %rbx
	shrq	$32, %rbx
	movl	%r14d, %eax
	imull	%ebx, %eax
	shlq	$32, %rax
	movq	%rax, %rcx
	sarq	$30, %rcx
	testq	%rax, %rax
	movq	$-1, %rdi
	cmovnsq	%rcx, %rdi
	callq	_Znam
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	leaq	64(%rsp), %r12
	movq	%r14, -8(%r12)
	leaq	48(%rsp), %r15
	movl	%ebx, -4(%r15)
	movl	%ebp, -8(%r15)
	leaq	8(%rsp), %rax
	movl	%ebx, -4(%rax)
	movl	%r14d, -8(%rax)
	imull	%r14d, %r13d
	shll	$2, %r13d
	movslq	%r13d, %r13
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movq	(%r12), %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leal	(,%rbx,4), %r13d
	movl	%r13d, %eax
	imull	%ebp, %eax
	movslq	%eax, %r12
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	movq	(%r15), %rdi
	movq	24(%rsp), %rsi                  # 8-byte Reload
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	imull	%r14d, %r13d
	movslq	%r13d, %r12
	leaq	8(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	addq	$15, %rbx
	shrq	$4, %rbx
	movq	%r14, %rax
	shlq	$28, %rax
	movl	$4026531840, %ecx               # imm = 0xF0000000
	addq	%rax, %rcx
	orq	%rbx, %rcx
	movabsq	$1152921500580315135, %rdi      # imm = 0xFFFFFFF0FFFFFFF
	andq	%rcx, %rdi
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_2
# %bb.1:
	movq	56(%rsp), %rdi
	movq	64(%rsp), %rsi
	movq	40(%rsp), %rdx
	movq	48(%rsp), %rcx
	movq	(%rsp), %r8
	movq	8(%rsp), %r9
	callq	_Z24__device_stub__matrixMul6matrixS_S_
.LBB2_2:
	movq	8(%rsp), %rsi
	movq	32(%rsp), %rbx                  # 8-byte Reload
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	64(%rsp), %rdi
	callq	hipFree
	movq	48(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movabsq	$-4294967296, %rax              # imm = 0xFFFFFFFF00000000
	andq	%rax, %rbp
	movl	%r14d, %eax
	orq	%rbp, %rax
	movq	%rbx, %rdx
	addq	$72, %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_end2:
	.size	_Z13matrixMul_gpu6matrixS_, .Lfunc_end2-_Z13matrixMul_gpu6matrixS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z13matrixMul_cpu6matrixS_      # -- Begin function _Z13matrixMul_cpu6matrixS_
	.type	_Z13matrixMul_cpu6matrixS_,@function
_Z13matrixMul_cpu6matrixS_:             # @_Z13matrixMul_cpu6matrixS_
	.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	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, 16(%rsp)                  # 8-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movq	%rdx, 8(%rsp)                   # 8-byte Spill
	movq	%rdx, %r13
	shrq	$32, %r13
	movl	%r13d, %eax
	imull	%ebx, %eax
	shlq	$32, %rax
	movq	%rax, %rcx
	sarq	$30, %rcx
	testq	%rax, %rax
	movq	$-1, %rdi
	cmovnsq	%rcx, %rdi
	callq	_Znam
	movq	%rax, %rdx
	movq	%rbx, (%rsp)                    # 8-byte Spill
	testl	%ebx, %ebx
	jle	.LBB3_9
# %bb.1:                                # %.preheader24.lr.ph
	movq	(%rsp), %rsi                    # 8-byte Reload
	movq	%rsi, %rax
	shrq	$32, %rax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	sarq	$32, %rcx
	movl	%esi, %esi
	leaq	(,%rcx,4), %rdi
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
.LBB3_2:                                # %.preheader24
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_4 Depth 2
                                        #       Child Loop BB3_6 Depth 3
	testl	%r13d, %r13d
	jle	.LBB3_8
# %bb.3:                                # %.preheader.lr.ph
                                        #   in Loop: Header=BB3_2 Depth=1
	movl	%r8d, %r10d
	leaq	(%r12,%r10,4), %r10
	movq	%r9, %r11
	imulq	%rcx, %r11
	leaq	(%rdx,%r11,4), %r11
	movq	16(%rsp), %r15                  # 8-byte Reload
	xorl	%r14d, %r14d
.LBB3_4:                                # %.preheader
                                        #   Parent Loop BB3_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB3_6 Depth 3
	xorps	%xmm0, %xmm0
	testl	%eax, %eax
	jle	.LBB3_7
# %bb.5:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB3_4 Depth=2
	movq	%r15, %rbp
	xorl	%ebx, %ebx
.LBB3_6:                                # %.lr.ph
                                        #   Parent Loop BB3_2 Depth=1
                                        #     Parent Loop BB3_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%r10,%rbx,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	(%rbp), %xmm1
	addss	%xmm1, %xmm0
	incq	%rbx
	addq	%rdi, %rbp
	cmpq	%rbx, %rax
	jne	.LBB3_6
.LBB3_7:                                # %._crit_edge
                                        #   in Loop: Header=BB3_4 Depth=2
	movss	%xmm0, (%r11,%r14,4)
	incq	%r14
	addq	$4, %r15
	cmpq	%r13, %r14
	jne	.LBB3_4
.LBB3_8:                                # %._crit_edge28
                                        #   in Loop: Header=BB3_2 Depth=1
	incq	%r9
	addl	%eax, %r8d
	cmpq	%rsi, %r9
	jne	.LBB3_2
.LBB3_9:                                # %._crit_edge30
	movabsq	$-4294967296, %rax              # imm = 0xFFFFFFFF00000000
	movq	8(%rsp), %rcx                   # 8-byte Reload
	andq	%rax, %rcx
	movl	(%rsp), %eax                    # 4-byte Reload
	orq	%rcx, %rax
	addq	$24, %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_end3:
	.size	_Z13matrixMul_cpu6matrixS_, .Lfunc_end3-_Z13matrixMul_cpu6matrixS_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z10randomInitPfif
.LCPI4_0:
	.long	0x30000000                      # float 4.65661287E-10
	.text
	.globl	_Z10randomInitPfif
	.type	_Z10randomInitPfif,@function
_Z10randomInitPfif:                     # @_Z10randomInitPfif
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB4_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
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	%esi, %r14d
	xorl	%r15d, %r15d
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
.LBB4_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	movss	12(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	xorps	%xmm1, %xmm1
	cvtsi2ss	%eax, %xmm1
	mulss	.LCPI4_0(%rip), %xmm1
	mulss	%xmm0, %xmm1
	movss	%xmm1, (%rbx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB4_2
# %bb.3:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	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
.LBB4_4:                                # %._crit_edge
	retq
.Lfunc_end4:
	.size	_Z10randomInitPfif, .Lfunc_end4-_Z10randomInitPfif
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI5_0:
	.long	0x30000000                      # float 4.65661287E-10
.LCPI5_1:
	.long	0x41200000                      # float 10
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI5_2:
	.quad	0x412e848000000000              # double 1.0E+6
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	$40960000, %edi                 # imm = 0x2710000
	callq	_Znam
	movq	%rax, %rbx
	movl	$40960000, %edi                 # imm = 0x2710000
	callq	_Znam
	movq	%rax, %r14
	xorl	%r15d, %r15d
.LBB5_1:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	movss	.LCPI5_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	%xmm1, %xmm0
	movss	.LCPI5_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm1, %xmm0
	movss	%xmm0, (%rbx,%r15,4)
	incq	%r15
	cmpq	$10240000, %r15                 # imm = 0x9C4000
	jne	.LBB5_1
# %bb.2:                                # %.lr.ph.i37.preheader
	xorl	%r15d, %r15d
.LBB5_3:                                # %.lr.ph.i37
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI5_0(%rip), %xmm0
	mulss	.LCPI5_1(%rip), %xmm0
	movss	%xmm0, (%r14,%r15,4)
	incq	%r15
	cmpq	$10240000, %r15                 # imm = 0x9C4000
	jne	.LBB5_3
# %bb.4:                                # %_Z10randomInitPfif.exit41
	callq	clock
	movq	%rax, %r12
	movabsq	$13743895350400, %r15           # imm = 0xC8000000C80
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r15, %rdx
	movq	%r14, %rcx
	callq	_Z13matrixMul_cpu6matrixS_
	callq	clock
	subq	%r12, %rax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	.LCPI5_2(%rip), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movl	$.L.str.2, %esi
	movl	$5, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	callq	clock
	movq	%rax, %r12
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r15, %rdx
	movq	%r14, %rcx
	callq	_Z13matrixMul_gpu6matrixS_
	movq	%rdx, %r15
	callq	clock
	movq	%rax, %r13
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	subq	%r12, %r13
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r13, %xmm0
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	divsd	.LCPI5_2(%rip), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movl	$.L.str.2, %esi
	movl	$5, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.4, %esi
	movl	$7, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r12
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rbx, %rdi
	callq	_ZdaPv
	movq	%r14, %rdi
	callq	_ZdaPv
	testq	%r15, %r15
	je	.LBB5_6
# %bb.5:
	movq	%r15, %rdi
	callq	_ZdaPv
.LBB5_6:
	xorl	%eax, %eax
	addq	$16, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	main, .Lfunc_end5-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB6_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB6_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9matrixMul6matrixS_S_, %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_end6:
	.size	__hip_module_ctor, .Lfunc_end6-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB7_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB7_2:
	retq
.Lfunc_end7:
	.size	__hip_module_dtor, .Lfunc_end7-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	" "
	.size	.L.str, 2

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

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"cpuMultime = "
	.size	.L.str.1, 14

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"sec.\n"
	.size	.L.str.2, 6

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"gpuMultime = "
	.size	.L.str.3, 14

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"rate = "
	.size	.L.str.4, 8

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9matrixMul6matrixS_S_"
	.size	.L__unnamed_1, 24

	.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__matrixMul6matrixS_S_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _ZSt4cout
	.addrsig_sym _Z9matrixMul6matrixS_S_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9matrixMul6matrixS_S_ ; -- Begin function _Z9matrixMul6matrixS_S_
	.globl	_Z9matrixMul6matrixS_S_
	.p2align	8
	.type	_Z9matrixMul6matrixS_S_,@function
_Z9matrixMul6matrixS_S_:                ; @_Z9matrixMul6matrixS_S_
; %bb.0:
	s_clause 0x1
	s_load_b32 s6, s[0:1], 0x3c
	s_load_b64 s[2:3], s[0:1], 0x20
	v_bfe_u32 v2, v0, 10, 10
	v_and_b32_e32 v3, 0x3ff, v0
	s_add_u32 s4, s0, 32
	s_addc_u32 s5, s1, 0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s7, s6, 16
	s_and_b32 s6, s6, 0xffff
	v_mad_u64_u32 v[0:1], null, s15, s7, v[2:3]
	v_mad_u64_u32 v[1:2], null, s14, s6, v[3:4]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_i32_e32 vcc_lo, s2, v0
	v_cmp_gt_i32_e64 s2, s3, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s6, s2
	s_cbranch_execz .LBB0_6
; %bb.1:                                ; %.preheader
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x4
	s_load_b64 s[4:5], s[4:5], 0x8
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s2, 1
	s_cbranch_scc1 .LBB0_4
; %bb.2:                                ; %.lr.ph
	s_load_b64 s[8:9], s[0:1], 0x8
	v_mul_lo_u32 v2, v0, s2
	s_clause 0x1
	s_load_b32 s6, s[0:1], 0x14
	s_load_b64 s[0:1], s[0:1], 0x18
	v_mov_b32_e32 v6, 0
	v_mov_b32_e32 v4, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s8, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v3, vcc_lo
.LBB0_3:                                ; =>This Inner Loop Header: Depth=1
	v_ashrrev_i32_e32 v5, 31, v4
	s_add_i32 s2, s2, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_cmp_eq_u32 s2, 0
	v_lshlrev_b64 v[7:8], 2, v[4:5]
	v_add_nc_u32_e32 v4, s6, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v7, vcc_lo, s0, v7
	v_add_co_ci_u32_e32 v8, vcc_lo, s1, v8, vcc_lo
	global_load_b32 v5, v[2:3], off
	global_load_b32 v7, v[7:8], off
	v_add_co_u32 v2, vcc_lo, v2, 4
	v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
	s_waitcnt vmcnt(0)
	v_fmac_f32_e32 v6, v5, v7
	s_cbranch_scc0 .LBB0_3
	s_branch .LBB0_5
.LBB0_4:
	v_mov_b32_e32 v6, 0
.LBB0_5:                                ; %Flow34
	v_mad_u64_u32 v[2:3], null, v0, 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, s4, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	global_store_b32 v[0:1], v6, off
.LBB0_6:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9matrixMul6matrixS_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 304
		.amdhsa_user_sgpr_count 14
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 9
		.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	_Z9matrixMul6matrixS_S_, .Lfunc_end0-_Z9matrixMul6matrixS_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 372
; NumSgprs: 18
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 9
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           16
        .value_kind:     by_value
      - .offset:         16
        .size:           16
        .value_kind:     by_value
      - .offset:         32
        .size:           16
        .value_kind:     by_value
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         52
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         60
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         62
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         64
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         66
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         68
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         70
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         112
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 304
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9matrixMul6matrixS_S_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9matrixMul6matrixS_S_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
