#include "cuda.h"
#include "cuda_runtime.h"
#include <cstdio>

#define CUDA_SAFE_CALL(expr)				\
	{						\
		cudaError_t err = (expr);		\
		if (err != cudaSuccess)			\
		{					\
			printf("Cuda error: %s\n", cudaGetErrorString(err));	\
			exit(1);			\
		}					\
	}

int main(void)
{
  int deviceCount;
  CUDA_SAFE_CALL(cudaGetDeviceCount(&deviceCount));
  printf("There are %d devices.\n\n", deviceCount);
  int device;
  for(device = 0; device<deviceCount; device++)
  {
    cudaDeviceProp deviceProp;
    CUDA_SAFE_CALL(cudaGetDeviceProperties(&deviceProp, device));
    if(device == 0)
    {
      if(deviceProp.major == 9999 && deviceProp.minor == 9999)
        printf("There is no device supporting CUDA.\n");
      else if(deviceCount == 1)
        printf("This is 1 device supporting CUDA.\n");
      else
        printf("There are %d devices supporting CUDA.\n", deviceCount);
    }
    printf("Device %d is called %s\n", device, deviceProp.name);

    printf("\tDevice Properties:\n");
    printf("\t\tHas timeout enabled: %d\n",deviceProp.kernelExecTimeoutEnabled);
    printf("\t\tECC enabled: %d\n",deviceProp.ECCEnabled);
    printf("\t\tClock rate %ld Hz\n",long(deviceProp.clockRate)*1000);
    printf("\t\tCompute capability: %d.%d\n",deviceProp.major,deviceProp.minor);
    printf("\t\tCompute mode: %d\n",deviceProp.computeMode);
    printf("\t\tConcurrent kernels: %d\n", deviceProp.concurrentKernels);
    printf("\t\tIntegrated device: %d\n",deviceProp.integrated);
    printf("\t\tSupports unified addressing: %d\n",deviceProp.unifiedAddressing);

    printf("\tCompute Properties:\n");
    printf("\t\tNumber of SMs: %d\n",deviceProp.multiProcessorCount);
    printf("\t\tWarp size: %d threads\n",deviceProp.warpSize);
    printf("\t\tMaximum threads per CTA: %d\n",deviceProp.maxThreadsPerBlock);
    printf("\t\tMaximum threads per SM: %d\n",deviceProp.maxThreadsPerMultiProcessor);
    printf("\t\tMaximum warps per CTA: %d\n",(deviceProp.maxThreadsPerBlock/deviceProp.warpSize));
    printf("\t\tMaximum warps per SM: %d\n",(deviceProp.maxThreadsPerMultiProcessor/deviceProp.warpSize));
    printf("\t\tMaximum grid size: ");
    for (int i=0; i<3; i++)
      printf("%d ",deviceProp.maxGridSize[i]);
    printf("\n");
    printf("\t\tMaximum CTA size: ");
    for (int i=0; i<3; i++)
      printf("%d ",deviceProp.maxThreadsDim[i]);
    printf("\n");

    printf("\tMemory Properties:\n");
    printf("\t\tTotal global memory: %ld bytes\n",deviceProp.totalGlobalMem);
    printf("\t\tTotal constant memory: %ld bytes\n",deviceProp.totalConstMem);
    printf("\t\tL2 cache size: %d bytes\n",deviceProp.l2CacheSize);
    printf("\t\tShared memory per block: %ld bytes\n",deviceProp.sharedMemPerBlock);
    printf("\t\tRegisters per block: %d\n",deviceProp.regsPerBlock);
    size_t stackSize,pfSize,heapSize;
    CUDA_SAFE_CALL(cudaDeviceGetLimit(&stackSize, cudaLimitStackSize));
    CUDA_SAFE_CALL(cudaDeviceGetLimit(&pfSize, cudaLimitPrintfFifoSize));
    CUDA_SAFE_CALL(cudaDeviceGetLimit(&heapSize, cudaLimitMallocHeapSize));
    printf("\t\tStack size per thread: %ld bytes\n",stackSize);
    printf("\t\tMalloc heap size: %ld bytes\n",heapSize);
    printf("\t\tPrintf buffer size: %ld bytes\n",pfSize);
    printf("\t\tMemory bus width: %d bits\n",deviceProp.memoryBusWidth); 
    printf("\t\tMemory pitch: %ld bytes\n",deviceProp.memPitch);

    printf("\tPCI-E Xfer Properties:\n");
    printf("\t\tNumber of asynchronous engines (async-copy enabled): %d\n",deviceProp.asyncEngineCount);
    printf("\t\tCan Map Host Memory: %d\n",deviceProp.canMapHostMemory);
    printf("\t\tPCI device ID: %d\n",deviceProp.pciDeviceID);
    printf("\t\tPCI bus ID: %d\n",deviceProp.pciBusID);
    
    printf("\n\n");
  }

  return 0;
}

	.file	"tmpxft_003589da_00000000-6_device_properties.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Cuda error: %s\n"
.LC1:
	.string	"There are %d devices.\n\n"
.LC2:
	.string	"There is no device supporting CUDA.\n"
.LC3:
	.string	"This is 1 device supporting CUDA.\n"
.LC4:
	.string	"There are %d devices supporting CUDA.\n"
.LC5:
	.string	"Device %d is called %s\n"
.LC6:
	.string	"\tDevice Properties:\n"
.LC7:
	.string	"\t\tHas timeout enabled: %d\n"
.LC8:
	.string	"\t\tECC enabled: %d\n"
.LC9:
	.string	"\t\tClock rate %ld Hz\n"
.LC10:
	.string	"\t\tCompute capability: %d.%d\n"
.LC11:
	.string	"\t\tCompute mode: %d\n"
.LC12:
	.string	"\t\tConcurrent kernels: %d\n"
.LC13:
	.string	"\t\tIntegrated device: %d\n"
.LC14:
	.string	"\t\tSupports unified addressing: %d\n"
.LC15:
	.string	"\tCompute Properties:\n"
.LC16:
	.string	"\t\tNumber of SMs: %d\n"
.LC17:
	.string	"\t\tWarp size: %d threads\n"
.LC18:
	.string	"\t\tMaximum threads per CTA: %d\n"
.LC19:
	.string	"\t\tMaximum threads per SM: %d\n"
.LC20:
	.string	"\t\tMaximum warps per CTA: %d\n"
.LC21:
	.string	"\t\tMaximum warps per SM: %d\n"
.LC22:
	.string	"\t\tMaximum grid size: "
.LC23:
	.string	"%d "
.LC24:
	.string	"\n"
.LC25:
	.string	"\t\tMaximum CTA size: "
.LC26:
	.string	"\tMemory Properties:\n"
.LC27:
	.string	"\t\tTotal global memory: %ld bytes\n"
.LC28:
	.string	"\t\tTotal constant memory: %ld bytes\n"
.LC29:
	.string	"\t\tL2 cache size: %d bytes\n"
.LC30:
	.string	"\t\tShared memory per block: %ld bytes\n"
.LC31:
	.string	"\t\tRegisters per block: %d\n"
.LC32:
	.string	"\t\tStack size per thread: %ld bytes\n"
.LC33:
	.string	"\t\tMalloc heap size: %ld bytes\n"
.LC34:
	.string	"\t\tPrintf buffer size: %ld bytes\n"
.LC35:
	.string	"\t\tMemory bus width: %d bits\n"
.LC36:
	.string	"\t\tMemory pitch: %ld bytes\n"
.LC37:
	.string	"\tPCI-E Xfer Properties:\n"
.LC38:
	.string	"\t\tNumber of asynchronous engines (async-copy enabled): %d\n"
.LC39:
	.string	"\t\tCan Map Host Memory: %d\n"
.LC40:
	.string	"\t\tPCI device ID: %d\n"
.LC41:
	.string	"\t\tPCI bus ID: %d\n"
.LC42:
	.string	"\n\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
	subq	$1080, %rsp
	.cfi_def_cfa_offset 1136
	movq	%fs:40, %rax
	movq	%rax, 1064(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdi
	call	cudaGetDeviceCount@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L22
	movl	4(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	movabsq	$42945378002703, %rbp
	movl	$2, %edi
	call	__printf_chk@PLT
	jmp	.L4
.L5:
	testl	%ebx, %ebx
	je	.L24
.L6:
	movq	%r12, %rcx
	movl	%ebx, %edx
	leaq	.LC5(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	leaq	.LC23(%rip), %r14
	call	__printf_chk@PLT
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	424(%rsp), %edx
	leaq	.LC7(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	612(%rsp), %edx
	leaq	.LC8(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movslq	380(%rsp), %rdx
	leaq	.LC9(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	imulq	$1000, %rdx, %rdx
	call	__printf_chk@PLT
	movl	396(%rsp), %ecx
	movl	$2, %edi
	xorl	%eax, %eax
	movl	392(%rsp), %edx
	leaq	.LC10(%rip), %rsi
	call	__printf_chk@PLT
	movl	436(%rsp), %edx
	leaq	.LC11(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	608(%rsp), %edx
	leaq	.LC12(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	428(%rsp), %edx
	leaq	.LC13(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	636(%rsp), %edx
	leaq	.LC14(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	420(%rsp), %edx
	leaq	.LC16(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	340(%rsp), %edx
	leaq	.LC17(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	352(%rsp), %edx
	leaq	.LC18(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	656(%rsp), %edx
	leaq	.LC19(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	352(%rsp), %eax
	movl	$2, %edi
	leaq	.LC20(%rip), %rsi
	cltd
	idivl	340(%rsp)
	xorl	%r12d, %r12d
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	656(%rsp), %eax
	movl	$2, %edi
	leaq	.LC21(%rip), %rsi
	cltd
	idivl	340(%rsp)
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC22(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L9:
	movl	368(%rsp,%r12), %edx
	movq	%r14, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	addq	$4, %r12
	call	__printf_chk@PLT
	cmpq	$12, %r12
	jne	.L9
	leaq	.LC24(%rip), %r13
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	movq	%r13, %rsi
	leaq	356(%rsp), %r15
	call	__printf_chk@PLT
	leaq	.LC25(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L10:
	movl	(%r15,%r12), %edx
	movq	%r14, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	addq	$4, %r12
	call	__printf_chk@PLT
	cmpq	$12, %r12
	jne	.L10
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC26(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	320(%rsp), %rdx
	leaq	.LC27(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	384(%rsp), %rdx
	leaq	.LC28(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	648(%rsp), %edx
	leaq	.LC29(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	328(%rsp), %rdx
	leaq	.LC30(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	336(%rsp), %edx
	leaq	.LC31(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	8(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaDeviceGetLimit@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L22
	leaq	16(%rsp), %rdi
	movl	$1, %esi
	call	cudaDeviceGetLimit@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L22
	leaq	24(%rsp), %rdi
	movl	$2, %esi
	call	cudaDeviceGetLimit@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L22
	movq	8(%rsp), %rdx
	leaq	.LC32(%rip), %rsi
	xorl	%eax, %eax
	incl	%ebx
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	24(%rsp), %rdx
	leaq	.LC33(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	16(%rsp), %rdx
	leaq	.LC34(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	644(%rsp), %edx
	leaq	.LC35(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	344(%rsp), %rdx
	leaq	.LC36(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC37(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	632(%rsp), %edx
	leaq	.LC38(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	432(%rsp), %edx
	leaq	.LC39(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	620(%rsp), %edx
	leaq	.LC40(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	616(%rsp), %edx
	leaq	.LC41(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC42(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L4:
	cmpl	%ebx, 4(%rsp)
	jle	.L25
	leaq	32(%rsp), %r12
	movl	%ebx, %esi
	movq	%r12, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L5
.L22:
	call	cudaGetErrorString@PLT
	movl	$2, %edi
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L24:
	leaq	.LC2(%rip), %rsi
	cmpq	%rbp, 392(%rsp)
	je	.L19
	movl	4(%rsp), %edx
	cmpl	$1, %edx
	jne	.L8
	leaq	.LC3(%rip), %rsi
.L19:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
.L8:
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
.L25:
	movq	1064(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$1080, %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
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2053:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2053:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include "hip/hip_runtime.h"

#include <cstdio>

#define CUDA_SAFE_CALL(expr)				\
	{						\
		hipError_t err = (expr);		\
		if (err != hipSuccess)			\
		{					\
			printf("Cuda error: %s\n", hipGetErrorString(err));	\
			exit(1);			\
		}					\
	}

int main(void)
{
  int deviceCount;
  CUDA_SAFE_CALL(hipGetDeviceCount(&deviceCount));
  printf("There are %d devices.\n\n", deviceCount);
  int device;
  for(device = 0; device<deviceCount; device++)
  {
    hipDeviceProp_t deviceProp;
    CUDA_SAFE_CALL(hipGetDeviceProperties(&deviceProp, device));
    if(device == 0)
    {
      if(deviceProp.major == 9999 && deviceProp.minor == 9999)
        printf("There is no device supporting CUDA.\n");
      else if(deviceCount == 1)
        printf("This is 1 device supporting CUDA.\n");
      else
        printf("There are %d devices supporting CUDA.\n", deviceCount);
    }
    printf("Device %d is called %s\n", device, deviceProp.name);

    printf("\tDevice Properties:\n");
    printf("\t\tHas timeout enabled: %d\n",deviceProp.kernelExecTimeoutEnabled);
    printf("\t\tECC enabled: %d\n",deviceProp.ECCEnabled);
    printf("\t\tClock rate %ld Hz\n",long(deviceProp.clockRate)*1000);
    printf("\t\tCompute capability: %d.%d\n",deviceProp.major,deviceProp.minor);
    printf("\t\tCompute mode: %d\n",deviceProp.computeMode);
    printf("\t\tConcurrent kernels: %d\n", deviceProp.concurrentKernels);
    printf("\t\tIntegrated device: %d\n",deviceProp.integrated);
    printf("\t\tSupports unified addressing: %d\n",deviceProp.unifiedAddressing);

    printf("\tCompute Properties:\n");
    printf("\t\tNumber of SMs: %d\n",deviceProp.multiProcessorCount);
    printf("\t\tWarp size: %d threads\n",deviceProp.warpSize);
    printf("\t\tMaximum threads per CTA: %d\n",deviceProp.maxThreadsPerBlock);
    printf("\t\tMaximum threads per SM: %d\n",deviceProp.maxThreadsPerMultiProcessor);
    printf("\t\tMaximum warps per CTA: %d\n",(deviceProp.maxThreadsPerBlock/deviceProp.warpSize));
    printf("\t\tMaximum warps per SM: %d\n",(deviceProp.maxThreadsPerMultiProcessor/deviceProp.warpSize));
    printf("\t\tMaximum grid size: ");
    for (int i=0; i<3; i++)
      printf("%d ",deviceProp.maxGridSize[i]);
    printf("\n");
    printf("\t\tMaximum CTA size: ");
    for (int i=0; i<3; i++)
      printf("%d ",deviceProp.maxThreadsDim[i]);
    printf("\n");

    printf("\tMemory Properties:\n");
    printf("\t\tTotal global memory: %ld bytes\n",deviceProp.totalGlobalMem);
    printf("\t\tTotal constant memory: %ld bytes\n",deviceProp.totalConstMem);
    printf("\t\tL2 cache size: %d bytes\n",deviceProp.l2CacheSize);
    printf("\t\tShared memory per block: %ld bytes\n",deviceProp.sharedMemPerBlock);
    printf("\t\tRegisters per block: %d\n",deviceProp.regsPerBlock);
    size_t stackSize,pfSize,heapSize;
    CUDA_SAFE_CALL(hipDeviceGetLimit(&stackSize, hipLimitStackSize));
    CUDA_SAFE_CALL(hipDeviceGetLimit(&pfSize, hipLimitPrintfFifoSize));
    CUDA_SAFE_CALL(hipDeviceGetLimit(&heapSize, hipLimitMallocHeapSize));
    printf("\t\tStack size per thread: %ld bytes\n",stackSize);
    printf("\t\tMalloc heap size: %ld bytes\n",heapSize);
    printf("\t\tPrintf buffer size: %ld bytes\n",pfSize);
    printf("\t\tMemory bus width: %d bits\n",deviceProp.memoryBusWidth); 
    printf("\t\tMemory pitch: %ld bytes\n",deviceProp.memPitch);

    printf("\tPCI-E Xfer Properties:\n");
    printf("\t\tNumber of asynchronous engines (async-copy enabled): %d\n",deviceProp.asyncEngineCount);
    printf("\t\tCan Map Host Memory: %d\n",deviceProp.canMapHostMemory);
    printf("\t\tPCI device ID: %d\n",deviceProp.pciDeviceID);
    printf("\t\tPCI bus ID: %d\n",deviceProp.pciBusID);
    
    printf("\n\n");
  }

  return 0;
}

	.text
	.file	"device_properties.hip"
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$1512, %rsp                     # imm = 0x5E8
	.cfi_def_cfa_offset 1568
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	12(%rsp), %rdi
	callq	hipGetDeviceCount
	testl	%eax, %eax
	jne	.LBB0_21
# %bb.1:
	movl	12(%rsp), %esi
	movl	$.L.str.1, %edi
	xorl	%eax, %eax
	callq	printf
	cmpl	$0, 12(%rsp)
	jle	.LBB0_20
# %bb.2:                                # %.lr.ph
	leaq	40(%rsp), %rbx
	leaq	32(%rsp), %r14
	leaq	24(%rsp), %r15
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
.LBB0_3:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_13 Depth 2
                                        #     Child Loop BB0_15 Depth 2
	movq	%rbx, %rdi
	movl	%ebp, %esi
	callq	hipGetDevicePropertiesR0600
	testl	%eax, %eax
	jne	.LBB0_21
# %bb.4:                                #   in Loop: Header=BB0_3 Depth=1
	testl	%ebp, %ebp
	jne	.LBB0_12
# %bb.5:                                #   in Loop: Header=BB0_3 Depth=1
	cmpl	$9999, 400(%rsp)                # imm = 0x270F
	jne	.LBB0_9
# %bb.6:                                #   in Loop: Header=BB0_3 Depth=1
	cmpl	$9999, 404(%rsp)                # imm = 0x270F
	jne	.LBB0_9
# %bb.7:                                #   in Loop: Header=BB0_3 Depth=1
	movl	$.Lstr.1, %edi
	jmp	.LBB0_8
.LBB0_9:                                #   in Loop: Header=BB0_3 Depth=1
	movl	12(%rsp), %esi
	cmpl	$1, %esi
	jne	.LBB0_11
# %bb.10:                               #   in Loop: Header=BB0_3 Depth=1
	movl	$.Lstr, %edi
.LBB0_8:                                #   in Loop: Header=BB0_3 Depth=1
	callq	puts@PLT
	jmp	.LBB0_12
.LBB0_11:                               #   in Loop: Header=BB0_3 Depth=1
	movl	$.L.str.4, %edi
	xorl	%eax, %eax
	callq	printf
.LBB0_12:                               #   in Loop: Header=BB0_3 Depth=1
	movl	$.L.str.5, %edi
	movl	%ebp, %esi
	movq	%rbx, %rdx
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	432(%rsp), %esi
	movl	$.L.str.7, %edi
	xorl	%eax, %eax
	callq	printf
	movl	620(%rsp), %esi
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	movslq	388(%rsp), %rax
	imulq	$1000, %rax, %rsi               # imm = 0x3E8
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	callq	printf
	movl	400(%rsp), %esi
	movl	404(%rsp), %edx
	movl	$.L.str.10, %edi
	xorl	%eax, %eax
	callq	printf
	movl	444(%rsp), %esi
	movl	$.L.str.11, %edi
	xorl	%eax, %eax
	callq	printf
	movl	616(%rsp), %esi
	movl	$.L.str.12, %edi
	xorl	%eax, %eax
	callq	printf
	movl	436(%rsp), %esi
	movl	$.L.str.13, %edi
	xorl	%eax, %eax
	callq	printf
	movl	644(%rsp), %esi
	movl	$.L.str.14, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	movl	428(%rsp), %esi
	movl	$.L.str.16, %edi
	xorl	%eax, %eax
	callq	printf
	movl	348(%rsp), %esi
	movl	$.L.str.17, %edi
	xorl	%eax, %eax
	callq	printf
	movl	360(%rsp), %esi
	movl	$.L.str.18, %edi
	xorl	%eax, %eax
	callq	printf
	movl	664(%rsp), %esi
	movl	$.L.str.19, %edi
	xorl	%eax, %eax
	callq	printf
	movl	360(%rsp), %eax
	cltd
	idivl	348(%rsp)
	movl	$.L.str.20, %edi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	printf
	movl	664(%rsp), %eax
	cltd
	idivl	348(%rsp)
	movl	$.L.str.21, %edi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.22, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$84, %r13d
.LBB0_13:                               #   Parent Loop BB0_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	40(%rsp,%r13,4), %esi
	movl	$.L.str.23, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r13
	cmpq	$87, %r13
	jne	.LBB0_13
# %bb.14:                               #   in Loop: Header=BB0_3 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	movl	$.L.str.25, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$81, %r13d
.LBB0_15:                               #   Parent Loop BB0_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	40(%rsp,%r13,4), %esi
	movl	$.L.str.23, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r13
	cmpq	$84, %r13
	jne	.LBB0_15
# %bb.16:                               #   in Loop: Header=BB0_3 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	movl	$.Lstr.4, %edi
	callq	puts@PLT
	movq	328(%rsp), %rsi
	movl	$.L.str.27, %edi
	xorl	%eax, %eax
	callq	printf
	movq	392(%rsp), %rsi
	movl	$.L.str.28, %edi
	xorl	%eax, %eax
	callq	printf
	movl	656(%rsp), %esi
	movl	$.L.str.29, %edi
	xorl	%eax, %eax
	callq	printf
	movq	336(%rsp), %rsi
	movl	$.L.str.30, %edi
	xorl	%eax, %eax
	callq	printf
	movl	344(%rsp), %esi
	movl	$.L.str.31, %edi
	xorl	%eax, %eax
	callq	printf
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	hipDeviceGetLimit
	testl	%eax, %eax
	jne	.LBB0_21
# %bb.17:                               #   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rdi
	movl	$1, %esi
	callq	hipDeviceGetLimit
	testl	%eax, %eax
	jne	.LBB0_21
# %bb.18:                               #   in Loop: Header=BB0_3 Depth=1
	movq	%r12, %rdi
	movl	$2, %esi
	callq	hipDeviceGetLimit
	testl	%eax, %eax
	jne	.LBB0_21
# %bb.19:                               #   in Loop: Header=BB0_3 Depth=1
	movq	32(%rsp), %rsi
	movl	$.L.str.32, %edi
	xorl	%eax, %eax
	callq	printf
	movq	16(%rsp), %rsi
	movl	$.L.str.33, %edi
	xorl	%eax, %eax
	callq	printf
	movq	24(%rsp), %rsi
	movl	$.L.str.34, %edi
	xorl	%eax, %eax
	callq	printf
	movl	652(%rsp), %esi
	movl	$.L.str.35, %edi
	xorl	%eax, %eax
	callq	printf
	movq	352(%rsp), %rsi
	movl	$.L.str.36, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.5, %edi
	callq	puts@PLT
	movl	640(%rsp), %esi
	movl	$.L.str.38, %edi
	xorl	%eax, %eax
	callq	printf
	movl	440(%rsp), %esi
	movl	$.L.str.39, %edi
	xorl	%eax, %eax
	callq	printf
	movl	628(%rsp), %esi
	movl	$.L.str.40, %edi
	xorl	%eax, %eax
	callq	printf
	movl	624(%rsp), %esi
	movl	$.L.str.41, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.6, %edi
	callq	puts@PLT
	incl	%ebp
	cmpl	12(%rsp), %ebp
	jl	.LBB0_3
.LBB0_20:                               # %._crit_edge
	xorl	%eax, %eax
	addq	$1512, %rsp                     # imm = 0x5E8
	.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
.LBB0_21:
	.cfi_def_cfa_offset 1568
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Cuda error: %s\n"
	.size	.L.str, 16

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"There are %d devices.\n\n"
	.size	.L.str.1, 24

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Device %d is called %s\n"
	.size	.L.str.5, 24

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"\t\tHas timeout enabled: %d\n"
	.size	.L.str.7, 27

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"\t\tECC enabled: %d\n"
	.size	.L.str.8, 19

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"\t\tClock rate %ld Hz\n"
	.size	.L.str.9, 21

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"\t\tCompute capability: %d.%d\n"
	.size	.L.str.10, 29

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"\t\tCompute mode: %d\n"
	.size	.L.str.11, 20

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"\t\tConcurrent kernels: %d\n"
	.size	.L.str.12, 26

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"\t\tIntegrated device: %d\n"
	.size	.L.str.13, 25

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"\t\tSupports unified addressing: %d\n"
	.size	.L.str.14, 35

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"\t\tNumber of SMs: %d\n"
	.size	.L.str.16, 21

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"\t\tWarp size: %d threads\n"
	.size	.L.str.17, 25

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"\t\tMaximum threads per CTA: %d\n"
	.size	.L.str.18, 31

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"\t\tMaximum threads per SM: %d\n"
	.size	.L.str.19, 30

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"\t\tMaximum warps per CTA: %d\n"
	.size	.L.str.20, 29

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"\t\tMaximum warps per SM: %d\n"
	.size	.L.str.21, 28

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"\t\tMaximum grid size: "
	.size	.L.str.22, 22

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"%d "
	.size	.L.str.23, 4

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	"\t\tMaximum CTA size: "
	.size	.L.str.25, 21

	.type	.L.str.27,@object               # @.str.27
.L.str.27:
	.asciz	"\t\tTotal global memory: %ld bytes\n"
	.size	.L.str.27, 34

	.type	.L.str.28,@object               # @.str.28
.L.str.28:
	.asciz	"\t\tTotal constant memory: %ld bytes\n"
	.size	.L.str.28, 36

	.type	.L.str.29,@object               # @.str.29
.L.str.29:
	.asciz	"\t\tL2 cache size: %d bytes\n"
	.size	.L.str.29, 27

	.type	.L.str.30,@object               # @.str.30
.L.str.30:
	.asciz	"\t\tShared memory per block: %ld bytes\n"
	.size	.L.str.30, 38

	.type	.L.str.31,@object               # @.str.31
.L.str.31:
	.asciz	"\t\tRegisters per block: %d\n"
	.size	.L.str.31, 27

	.type	.L.str.32,@object               # @.str.32
.L.str.32:
	.asciz	"\t\tStack size per thread: %ld bytes\n"
	.size	.L.str.32, 36

	.type	.L.str.33,@object               # @.str.33
.L.str.33:
	.asciz	"\t\tMalloc heap size: %ld bytes\n"
	.size	.L.str.33, 31

	.type	.L.str.34,@object               # @.str.34
.L.str.34:
	.asciz	"\t\tPrintf buffer size: %ld bytes\n"
	.size	.L.str.34, 33

	.type	.L.str.35,@object               # @.str.35
.L.str.35:
	.asciz	"\t\tMemory bus width: %d bits\n"
	.size	.L.str.35, 29

	.type	.L.str.36,@object               # @.str.36
.L.str.36:
	.asciz	"\t\tMemory pitch: %ld bytes\n"
	.size	.L.str.36, 27

	.type	.L.str.38,@object               # @.str.38
.L.str.38:
	.asciz	"\t\tNumber of asynchronous engines (async-copy enabled): %d\n"
	.size	.L.str.38, 59

	.type	.L.str.39,@object               # @.str.39
.L.str.39:
	.asciz	"\t\tCan Map Host Memory: %d\n"
	.size	.L.str.39, 27

	.type	.L.str.40,@object               # @.str.40
.L.str.40:
	.asciz	"\t\tPCI device ID: %d\n"
	.size	.L.str.40, 21

	.type	.L.str.41,@object               # @.str.41
.L.str.41:
	.asciz	"\t\tPCI bus ID: %d\n"
	.size	.L.str.41, 18

	.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	"This is 1 device supporting CUDA."
	.size	.Lstr, 34

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"There is no device supporting CUDA."
	.size	.Lstr.1, 36

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"\tDevice Properties:"
	.size	.Lstr.2, 20

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"\tCompute Properties:"
	.size	.Lstr.3, 21

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"\tMemory Properties:"
	.size	.Lstr.4, 20

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"\tPCI-E Xfer Properties:"
	.size	.Lstr.5, 24

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

	.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_

	.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_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
