#include <stdio.h>

int main(void){
    int counter, i;
    cudaDeviceProp properties;

    cudaGetDeviceCount(&counter);
    printf("Device count:%d\n", counter);

    for(i=0; i<counter; i++){
        cudaGetDeviceProperties(&properties, i);
        printf("\n\nDEVICE %d: \n",i);
        printf("name: %s\ntotalGlobalMam: %d\nsharedMemPerBlock: %d\nregsPerBlock: %d\nwarpSize: %d\nmemPitch: %d\nmaxThreadsPerBlock: %d\nmaxThreadsDim[3]: %d\nmaxGridSize[3]: %d\ntotalConstMem: %d\nmajor: %d\nminor: %d\nclockRate: %d\ntextureAlignment: %d\ndeviceOverlap: %d\nmultiProcessorCount: %d\nkernelExecTimeoutEnabled: %d\nintegrated: %d\ncanMapHostMemory: %d\ncomputeMode: %d\nconcurrentKernels: %d\nECCEnabled: %d\npciBusID: %d\npciDeviceID: %d\ntccDriver: %d\n",
            properties.name,
            properties.totalGlobalMem,
            properties.sharedMemPerBlock,
            properties.regsPerBlock,
            properties.warpSize,
            properties.memPitch,
            properties.maxThreadsPerBlock,
            properties.maxThreadsDim[3],
            properties.maxGridSize[3],
            properties.totalConstMem,
            properties.major,
            properties.minor,
            properties.clockRate,
            properties.textureAlignment,
            properties.deviceOverlap,
            properties.multiProcessorCount,
            properties.kernelExecTimeoutEnabled,
            properties.integrated,
            properties.canMapHostMemory,
            properties.computeMode,
            properties.concurrentKernels,
            properties.ECCEnabled,
            properties.pciBusID,
            properties.pciDeviceID,
            properties.tccDriver
        );
    }
}
	.file	"tmpxft_003a8e47_00000000-6_device_info.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	"Device count:%d\n"
.LC1:
	.string	"\n\nDEVICE %d: \n"
.LC2:
	.ascii	"name: %s\ntotalGlobalMam: %d\nsharedMemPerBlock: %d\nregsPer"
	.ascii	"Block: %d\nwarpSize: %d\nmemPitch: %d\nmaxThreadsPerBlock: %"
	.ascii	"d\nmaxThreadsDim[3]: %d\nmaxGridSize[3]: %d\ntotalConstMem: "
	.ascii	"%d\nma"
	.string	"jor: %d\nminor: %d\nclockRate: %d\ntextureAlignment: %d\ndeviceOverlap: %d\nmultiProcessorCount: %d\nkernelExecTimeoutEnabled: %d\nintegrated: %d\ncanMapHostMemory: %d\ncomputeMode: %d\nconcurrentKernels: %d\nECCEnabled: %d\npciBusID: %d\npciDeviceID: %d\ntccDriver: %d\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	subq	$1056, %rsp
	.cfi_def_cfa_offset 1088
	movq	%fs:40, %rax
	movq	%rax, 1048(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdi
	call	cudaGetDeviceCount@PLT
	movl	12(%rsp), %edx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rsi
	call	__printf_chk@PLT
.L3:
	cmpl	%ebx, 12(%rsp)
	jle	.L8
	leaq	16(%rsp), %rbp
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movl	%ebx, %edx
	movq	%r12, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incl	%ebx
	call	__printf_chk@PLT
	movl	364(%rsp), %eax
	movl	$2, %edi
	leaq	.LC2(%rip), %rsi
	pushq	%rdx
	.cfi_def_cfa_offset 1096
	movl	620(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1104
	movl	620(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1112
	movl	624(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1120
	movl	628(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1128
	movl	632(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1136
	movl	468(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1144
	movl	472(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1152
	movl	476(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1160
	movl	480(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1168
	movl	484(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1176
	movl	488(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1184
	pushq	480(%rsp)
	.cfi_def_cfa_offset 1192
	pushq	%rax
	.cfi_def_cfa_offset 1200
	movl	492(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1208
	movl	496(%rsp), %edx
	pushq	%rdx
	.cfi_def_cfa_offset 1216
	movq	%rbp, %rdx
	pushq	496(%rsp)
	.cfi_def_cfa_offset 1224
	pushq	%rax
	.cfi_def_cfa_offset 1232
	movl	496(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1240
	movl	488(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1248
	pushq	488(%rsp)
	.cfi_def_cfa_offset 1256
	movl	492(%rsp), %eax
	pushq	%rax
	.cfi_def_cfa_offset 1264
	movl	496(%rsp), %r9d
	xorl	%eax, %eax
	movq	488(%rsp), %r8
	movq	480(%rsp), %rcx
	call	__printf_chk@PLT
	addq	$176, %rsp
	.cfi_def_cfa_offset 1088
	jmp	.L3
.L8:
	movq	1048(%rsp), %rax
	subq	%fs:40, %rax
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	addq	$1056, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.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 <stdio.h>

int main(void){
    int counter, i;
    hipDeviceProp_t properties;

    hipGetDeviceCount(&counter);
    printf("Device count:%d\n", counter);

    for(i=0; i<counter; i++){
        hipGetDeviceProperties(&properties, i);
        printf("\n\nDEVICE %d: \n",i);
        printf("name: %s\ntotalGlobalMam: %d\nsharedMemPerBlock: %d\nregsPerBlock: %d\nwarpSize: %d\nmemPitch: %d\nmaxThreadsPerBlock: %d\nmaxThreadsDim[3]: %d\nmaxGridSize[3]: %d\ntotalConstMem: %d\nmajor: %d\nminor: %d\nclockRate: %d\ntextureAlignment: %d\ndeviceOverlap: %d\nmultiProcessorCount: %d\nkernelExecTimeoutEnabled: %d\nintegrated: %d\ncanMapHostMemory: %d\ncomputeMode: %d\nconcurrentKernels: %d\nECCEnabled: %d\npciBusID: %d\npciDeviceID: %d\ntccDriver: %d\n",
            properties.name,
            properties.totalGlobalMem,
            properties.sharedMemPerBlock,
            properties.regsPerBlock,
            properties.warpSize,
            properties.memPitch,
            properties.maxThreadsPerBlock,
            properties.maxThreadsDim[3],
            properties.maxGridSize[3],
            properties.totalConstMem,
            properties.major,
            properties.minor,
            properties.clockRate,
            properties.textureAlignment,
            properties.deviceOverlap,
            properties.multiProcessorCount,
            properties.kernelExecTimeoutEnabled,
            properties.integrated,
            properties.canMapHostMemory,
            properties.computeMode,
            properties.concurrentKernels,
            properties.ECCEnabled,
            properties.pciBusID,
            properties.pciDeviceID,
            properties.tccDriver
        );
    }
}
	.text
	.file	"device_info.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	$1560, %rsp                     # imm = 0x618
	.cfi_def_cfa_offset 1616
	.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), %rbx
	movq	%rbx, %rdi
	callq	hipGetDeviceCount
	movl	(%rbx), %esi
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	printf
	cmpl	$0, (%rbx)
	jle	.LBB0_3
# %bb.1:                                # %.lr.ph
	xorl	%ebp, %ebp
.LBB0_2:                                # =>This Inner Loop Header: Depth=1
	leaq	88(%rsp), %rdi
	movl	%ebp, %esi
	callq	hipGetDevicePropertiesR0600
	movl	$.L.str.1, %edi
	movl	%ebp, %esi
	xorl	%eax, %eax
	callq	printf
	movq	376(%rsp), %rdx
	movq	384(%rsp), %rcx
	movl	392(%rsp), %r8d
	movl	396(%rsp), %r9d
	movl	408(%rsp), %eax
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	movl	424(%rsp), %eax
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	movl	436(%rsp), %eax
	movq	%rax, 48(%rsp)                  # 8-byte Spill
	movl	448(%rsp), %eax
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	movl	452(%rsp), %eax
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movl	472(%rsp), %eax
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	movl	476(%rsp), %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movl	480(%rsp), %eax
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	movl	484(%rsp), %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	488(%rsp), %r15d
	movl	492(%rsp), %r12d
	movl	664(%rsp), %r13d
	movl	668(%rsp), %ebx
	movl	672(%rsp), %r10d
	movl	676(%rsp), %r11d
	movl	684(%rsp), %r14d
	movl	$.L.str.2, %edi
	leaq	88(%rsp), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_adjust_cfa_offset 8
	pushq	%r11
	.cfi_adjust_cfa_offset 8
	pushq	%r10
	.cfi_adjust_cfa_offset 8
	pushq	%rbx
	.cfi_adjust_cfa_offset 8
	pushq	%r13
	.cfi_adjust_cfa_offset 8
	pushq	%r12
	.cfi_adjust_cfa_offset 8
	pushq	%r15
	.cfi_adjust_cfa_offset 8
	pushq	72(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	88(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	104(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	120(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	544(%rsp)
	.cfi_adjust_cfa_offset 8
	movq	144(%rsp), %r10                 # 8-byte Reload
	pushq	%r10
	.cfi_adjust_cfa_offset 8
	pushq	160(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	176(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	560(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	%r10
	.cfi_adjust_cfa_offset 8
	pushq	208(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	224(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	552(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	printf
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	incl	%ebp
	cmpl	12(%rsp), %ebp
	jl	.LBB0_2
.LBB0_3:                                # %._crit_edge
	xorl	%eax, %eax
	addq	$1560, %rsp                     # imm = 0x618
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Device count:%d\n"
	.size	.L.str, 17

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"name: %s\ntotalGlobalMam: %d\nsharedMemPerBlock: %d\nregsPerBlock: %d\nwarpSize: %d\nmemPitch: %d\nmaxThreadsPerBlock: %d\nmaxThreadsDim[3]: %d\nmaxGridSize[3]: %d\ntotalConstMem: %d\nmajor: %d\nminor: %d\nclockRate: %d\ntextureAlignment: %d\ndeviceOverlap: %d\nmultiProcessorCount: %d\nkernelExecTimeoutEnabled: %d\nintegrated: %d\ncanMapHostMemory: %d\ncomputeMode: %d\nconcurrentKernels: %d\nECCEnabled: %d\npciBusID: %d\npciDeviceID: %d\ntccDriver: %d\n"
	.size	.L.str.2, 433

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