/*
   nvcc gpu_info.cu -o gpu_info.x

Michael Pohoreski
Copyleft {c} 2013

*/
#include <stdio.h>
#include <cuda.h>

/*
    GeForce GTX Titan @ 928 MHz
        SM: 14 * 192 sm/core = 2688 Cores
        384-bit @ 3004 MHz = 288 GB/s

    GeForce GT 750M @ 925 MHz
        2 * 192 Cores/SM = 384 Cores
        128-bit @ 2508 MHz = 80 GB/s

    GeForce GT 330M @ 1100 MHz
        SM: 6 * 8 sm/core = 48 Cores
        128-bit @ 790 MHz = 25 GB/s
*/

int CudaGetCores( int major, int minor )
{
    int cores[] = {
          8,  8, 8, 8, 0,   0, // 1.0  1.1  1.2  1.3  -.-  -.-
         32, 48, 0, 0, 0,   0, // 2.0  2.1
        192,  0, 0, 0, 0, 192, // 3.0                      3.5
        256,  0, 0, 0, 0,   0  // 4.0
    };

    return cores[ 6*(major-1) + minor ];
}

// cudaDeviceProp()
// Reference: http://developer.download.nvidia.com/compute/cuda/4_1/rel/toolkit/docs/online/group__CUDART__DEVICE_g5aa4f47938af8276f08074d09b7d520c.html
// https://devblogs.nvidia.com/parallelforall/how-query-device-properties-and-handle-errors-cuda-cc/
// https://devblogs.nvidia.com/parallelforall/how-implement-performance-metrics-cuda-cc/
int main()
{
    int devices;
    cudaError_t error = cudaGetDeviceCount( &devices );
    if( error != cudaSuccess )
        return printf( "ERROR: Couldn't find any CUDA devices.\n" );

    for( int device = 0; device < devices; device++ )
    {
        cudaDeviceProp prop;

        cudaGetDeviceProperties( &prop, device );

        printf( "\nGPU #%d: \'%s\' @ %d MHz\n", (device+1), prop.name, (prop.clockRate/1000) );
        printf( "   Compute: %d.%d\n", prop.major, prop.minor );
        printf( "   Multi Processors: %d * %d Cores/SM = %d Cores\n"
           , prop.multiProcessorCount
           , CudaGetCores( prop.major, prop.minor )
           , prop.multiProcessorCount * CudaGetCores( prop.major, prop.minor )
        );

        printf( "\n=== Memory ===\n" );
        printf( "   Total Memory : %lu MB (%lu bytes)\n", (prop.totalGlobalMem/1024)/1024, (size_t)prop.totalGlobalMem );
        printf( "   Bus Width    : %u-bit @ %d MHz ==> ", prop. memoryBusWidth, prop.memoryClockRate/1000 );
        printf( "   Max Bandwidth: %u GB/s\n"           , (prop.memoryClockRate/1000 * ((prop. memoryBusWidth/8)*2))/1000 ); // DDR2/3/4/5 = *2
        printf( "   Const memory : %lu (bytes)\n"       , prop.totalConstMem     );
        printf( "   Memory/Block : %lu\n"               , prop.sharedMemPerBlock );
        printf( "   Unified mem  : %d\n"                , prop.unifiedAddressing );

        printf( "\n=== Threads ===\n" );
        printf( "   Max Threads/SM : %d \n"       , prop.maxThreadsPerMultiProcessor );
        printf( "   Threads / Block: %d\n"        , prop.maxThreadsPerBlock );
        printf( "   Max Thread Size: %d, %d, %d\n", prop.maxThreadsDim[0], prop.maxThreadsDim[1], prop.maxThreadsDim[2] );
        printf( "   Max Grid size  : %u, %u, %u\n", prop.maxGridSize  [0], prop.maxGridSize  [1], prop.maxGridSize  [2] );
        printf( "   Registers/Block: %d\n"        , prop.regsPerBlock );

        printf( "\n=== Texture ===\n" );
        printf( "   Texture Size 1D: %d          \n", prop.maxTexture1D                                                );
        printf( "   Texture Size 2D: %d x %d     \n", prop.maxTexture2D[0], prop.maxTexture2D[1]                       );
        printf( "   Texture Size 3D: %d x %d x %d\n", prop.maxTexture3D[0], prop.maxTexture3D[1], prop.maxTexture3D[2] );

        printf( "\n" );
    }

    return 0;
}

	.file	"tmpxft_00268de0_00000000-6_gpu_info.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2031:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata
	.align 32
.LC0:
	.long	8
	.long	8
	.long	8
	.long	8
	.long	0
	.long	0
	.long	32
	.long	48
	.long	0
	.long	0
	.long	0
	.long	0
	.long	192
	.long	0
	.long	0
	.long	0
	.long	0
	.long	192
	.long	256
	.long	0
	.long	0
	.long	0
	.long	0
	.long	0
	.text
	.globl	_Z12CudaGetCoresii
	.type	_Z12CudaGetCoresii, @function
_Z12CudaGetCoresii:
.LFB2027:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movl	%edi, %eax
	movl	%esi, %edx
	movq	%fs:40, %rcx
	movq	%rcx, 104(%rsp)
	xorl	%ecx, %ecx
	leaq	8(%rsp), %rdi
	leaq	.LC0(%rip), %rsi
	decl	%eax
	movl	$24, %ecx
	imull	$6, %eax, %eax
	rep movsl
	addl	%edx, %eax
	cltq
	movl	8(%rsp,%rax,4), %eax
	movq	104(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z12CudaGetCoresii, .-_Z12CudaGetCoresii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"ERROR: Couldn't find any CUDA devices.\n"
.LC2:
	.string	"\nGPU #%d: '%s' @ %d MHz\n"
.LC3:
	.string	"   Compute: %d.%d\n"
.LC4:
	.string	"   Multi Processors: %d * %d Cores/SM = %d Cores\n"
.LC5:
	.string	"\n=== Memory ===\n"
.LC6:
	.string	"   Total Memory : %lu MB (%lu bytes)\n"
.LC7:
	.string	"   Bus Width    : %u-bit @ %d MHz ==> "
.LC8:
	.string	"   Max Bandwidth: %u GB/s\n"
.LC9:
	.string	"   Const memory : %lu (bytes)\n"
.LC10:
	.string	"   Memory/Block : %lu\n"
.LC11:
	.string	"   Unified mem  : %d\n"
.LC12:
	.string	"\n=== Threads ===\n"
.LC13:
	.string	"   Max Threads/SM : %d \n"
.LC14:
	.string	"   Threads / Block: %d\n"
.LC15:
	.string	"   Max Thread Size: %d, %d, %d\n"
.LC16:
	.string	"   Max Grid size  : %u, %u, %u\n"
.LC17:
	.string	"   Registers/Block: %d\n"
.LC18:
	.string	"\n=== Texture ===\n"
.LC19:
	.string	"   Texture Size 1D: %d          \n"
.LC20:
	.string	"   Texture Size 2D: %d x %d     \n"
.LC21:
	.string	"   Texture Size 3D: %d x %d x %d\n"
.LC22:
	.string	"\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$1064, %rsp
	.cfi_def_cfa_offset 1104
	movq	%fs:40, %rax
	movq	%rax, 1048(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdi
	call	cudaGetDeviceCount@PLT
	testl	%eax, %eax
	je	.L7
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
.L7:
	cmpl	%ebp, 12(%rsp)
	jle	.L15
	leaq	16(%rsp), %r13
	movl	%ebp, %esi
	movl	$1000, %ebx
	incl	%ebp
	movq	%r13, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	movq	%r13, %rcx
	movq	%r12, %rsi
	movl	$2, %edi
	movl	364(%rsp), %eax
	cltd
	idivl	%ebx
	movl	%ebp, %edx
	movl	%eax, %r8d
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	380(%rsp), %ecx
	movl	$2, %edi
	xorl	%eax, %eax
	movl	376(%rsp), %edx
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movl	404(%rsp), %r13d
	movl	380(%rsp), %esi
	movl	376(%rsp), %edi
	call	_Z12CudaGetCoresii
	movl	%r13d, %r8d
	movl	%r13d, %edx
	movl	$2, %edi
	imull	%eax, %r8d
	movl	%eax, %ecx
	leaq	.LC4(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	304(%rsp), %rcx
	leaq	.LC6(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	movq	%rcx, %rdx
	shrq	$20, %rdx
	call	__printf_chk@PLT
	movl	624(%rsp), %eax
	movl	$2, %edi
	leaq	.LC7(%rip), %rsi
	cltd
	idivl	%ebx
	movl	628(%rsp), %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$8, %ecx
	movl	$2, %edi
	movl	628(%rsp), %eax
	leaq	.LC8(%rip), %rsi
	cltd
	idivl	%ecx
	movl	%eax, %ecx
	movl	624(%rsp), %eax
	cltd
	idivl	%ebx
	imull	%ecx, %eax
	movl	$500, %ecx
	cltd
	idivl	%ecx
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	368(%rsp), %rdx
	leaq	.LC9(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	312(%rsp), %rdx
	xorl	%eax, %eax
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	620(%rsp), %edx
	leaq	.LC11(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	640(%rsp), %edx
	leaq	.LC13(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	336(%rsp), %edx
	leaq	.LC14(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	348(%rsp), %r8d
	xorl	%eax, %eax
	movl	344(%rsp), %ecx
	movl	340(%rsp), %edx
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	360(%rsp), %r8d
	xorl	%eax, %eax
	movl	356(%rsp), %ecx
	movl	352(%rsp), %edx
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	320(%rsp), %edx
	leaq	.LC17(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC18(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	424(%rsp), %edx
	leaq	.LC19(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	440(%rsp), %ecx
	movl	$2, %edi
	xorl	%eax, %eax
	movl	436(%rsp), %edx
	leaq	.LC20(%rip), %rsi
	call	__printf_chk@PLT
	movl	480(%rsp), %r8d
	xorl	%eax, %eax
	movl	476(%rsp), %ecx
	movl	472(%rsp), %edx
	leaq	.LC21(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC22(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
.L15:
	xorl	%eax, %eax
.L6:
	movq	1048(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$1064, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
	.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
.LFE2054:
	.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:

/*
   nvcc gpu_info.cu -o gpu_info.x

Michael Pohoreski
Copyleft {c} 2013

*/
#include <stdio.h>
#include <hip/hip_runtime.h>

/*
    GeForce GTX Titan @ 928 MHz
        SM: 14 * 192 sm/core = 2688 Cores
        384-bit @ 3004 MHz = 288 GB/s

    GeForce GT 750M @ 925 MHz
        2 * 192 Cores/SM = 384 Cores
        128-bit @ 2508 MHz = 80 GB/s

    GeForce GT 330M @ 1100 MHz
        SM: 6 * 8 sm/core = 48 Cores
        128-bit @ 790 MHz = 25 GB/s
*/

int CudaGetCores( int major, int minor )
{
    int cores[] = {
          8,  8, 8, 8, 0,   0, // 1.0  1.1  1.2  1.3  -.-  -.-
         32, 48, 0, 0, 0,   0, // 2.0  2.1
        192,  0, 0, 0, 0, 192, // 3.0                      3.5
        256,  0, 0, 0, 0,   0  // 4.0
    };

    return cores[ 6*(major-1) + minor ];
}

// cudaDeviceProp()
// Reference: http://developer.download.nvidia.com/compute/cuda/4_1/rel/toolkit/docs/online/group__CUDART__DEVICE_g5aa4f47938af8276f08074d09b7d520c.html
// https://devblogs.nvidia.com/parallelforall/how-query-device-properties-and-handle-errors-cuda-cc/
// https://devblogs.nvidia.com/parallelforall/how-implement-performance-metrics-cuda-cc/
int main()
{
    int devices;
    hipError_t error = hipGetDeviceCount( &devices );
    if( error != hipSuccess )
        return printf( "ERROR: Couldn't find any CUDA devices.\n" );

    for( int device = 0; device < devices; device++ )
    {
        hipDeviceProp_t prop;

        hipGetDeviceProperties( &prop, device );

        printf( "\nGPU #%d: \'%s\' @ %d MHz\n", (device+1), prop.name, (prop.clockRate/1000) );
        printf( "   Compute: %d.%d\n", prop.major, prop.minor );
        printf( "   Multi Processors: %d * %d Cores/SM = %d Cores\n"
           , prop.multiProcessorCount
           , CudaGetCores( prop.major, prop.minor )
           , prop.multiProcessorCount * CudaGetCores( prop.major, prop.minor )
        );

        printf( "\n=== Memory ===\n" );
        printf( "   Total Memory : %lu MB (%lu bytes)\n", (prop.totalGlobalMem/1024)/1024, (size_t)prop.totalGlobalMem );
        printf( "   Bus Width    : %u-bit @ %d MHz ==> ", prop. memoryBusWidth, prop.memoryClockRate/1000 );
        printf( "   Max Bandwidth: %u GB/s\n"           , (prop.memoryClockRate/1000 * ((prop. memoryBusWidth/8)*2))/1000 ); // DDR2/3/4/5 = *2
        printf( "   Const memory : %lu (bytes)\n"       , prop.totalConstMem     );
        printf( "   Memory/Block : %lu\n"               , prop.sharedMemPerBlock );
        printf( "   Unified mem  : %d\n"                , prop.unifiedAddressing );

        printf( "\n=== Threads ===\n" );
        printf( "   Max Threads/SM : %d \n"       , prop.maxThreadsPerMultiProcessor );
        printf( "   Threads / Block: %d\n"        , prop.maxThreadsPerBlock );
        printf( "   Max Thread Size: %d, %d, %d\n", prop.maxThreadsDim[0], prop.maxThreadsDim[1], prop.maxThreadsDim[2] );
        printf( "   Max Grid size  : %u, %u, %u\n", prop.maxGridSize  [0], prop.maxGridSize  [1], prop.maxGridSize  [2] );
        printf( "   Registers/Block: %d\n"        , prop.regsPerBlock );

        printf( "\n=== Texture ===\n" );
        printf( "   Texture Size 1D: %d          \n", prop.maxTexture1D                                                );
        printf( "   Texture Size 2D: %d x %d     \n", prop.maxTexture2D[0], prop.maxTexture2D[1]                       );
        printf( "   Texture Size 3D: %d x %d x %d\n", prop.maxTexture3D[0], prop.maxTexture3D[1], prop.maxTexture3D[2] );

        printf( "\n" );
    }

    return 0;
}

	.text
	.file	"gpu_info.hip"
	.globl	_Z12CudaGetCoresii              # -- Begin function _Z12CudaGetCoresii
	.type	_Z12CudaGetCoresii,@function
_Z12CudaGetCoresii:                     # @_Z12CudaGetCoresii
	.cfi_startproc
# %bb.0:
                                        # kill: def $esi killed $esi def $rsi
                                        # kill: def $edi killed $edi def $rdi
	leal	(%rdi,%rdi,2), %eax
	leal	(%rsi,%rax,2), %eax
	addl	$-6, %eax
	cltq
	movl	.L__const._Z12CudaGetCoresii.cores(,%rax,4), %eax
	retq
.Lfunc_end0:
	.size	_Z12CudaGetCoresii, .Lfunc_end0-_Z12CudaGetCoresii
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$1488, %rsp                     # imm = 0x5D0
	.cfi_def_cfa_offset 1520
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %rbp, -16
	leaq	12(%rsp), %rdi
	callq	hipGetDeviceCount
	testl	%eax, %eax
	je	.LBB1_1
# %bb.3:
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	printf
	movl	%eax, %ebx
	jmp	.LBB1_6
.LBB1_1:                                # %.preheader
	cmpl	$0, 12(%rsp)
	jle	.LBB1_2
# %bb.4:                                # %.lr.ph
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r14
	xorl	%ebp, %ebp
.LBB1_5:                                # =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%ebp, %esi
	callq	hipGetDevicePropertiesR0600
	incl	%ebp
	movslq	364(%rsp), %rax
	imulq	$274877907, %rax, %rcx          # imm = 0x10624DD3
	movq	%rcx, %rax
	shrq	$63, %rax
	sarq	$38, %rcx
	addl	%eax, %ecx
	movl	$.L.str.1, %edi
	movl	%ebp, %esi
	movq	%r14, %rdx
                                        # kill: def $ecx killed $ecx killed $rcx
	xorl	%eax, %eax
	callq	printf
	movl	376(%rsp), %esi
	movl	380(%rsp), %edx
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	printf
	movl	376(%rsp), %eax
	movl	404(%rsp), %esi
	movslq	380(%rsp), %rcx
	leal	(%rax,%rax,2), %eax
	leal	-6(,%rax,2), %eax
	cltq
	addq	%rcx, %rax
	movl	.L__const._Z12CudaGetCoresii.cores(,%rax,4), %edx
	movl	%edx, %ecx
	imull	%esi, %ecx
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr, %edi
	callq	puts@PLT
	movq	304(%rsp), %rdx
	movq	%rdx, %rsi
	shrq	$20, %rsi
	movl	$.L.str.5, %edi
	xorl	%eax, %eax
	callq	printf
	movl	628(%rsp), %esi
	movslq	624(%rsp), %rax
	imulq	$274877907, %rax, %rdx          # imm = 0x10624DD3
	movq	%rdx, %rax
	shrq	$63, %rax
	sarq	$38, %rdx
	addl	%eax, %edx
	movl	$.L.str.6, %edi
                                        # kill: def $edx killed $edx killed $rdx
	xorl	%eax, %eax
	callq	printf
	movslq	624(%rsp), %rax
	imulq	$274877907, %rax, %rax          # imm = 0x10624DD3
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$38, %rax
	addl	%ecx, %eax
	movl	628(%rsp), %ecx
	leal	7(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$3, %edx
	imull	%eax, %edx
	addl	%edx, %edx
	movslq	%edx, %rax
	imulq	$274877907, %rax, %rsi          # imm = 0x10624DD3
	movq	%rsi, %rax
	shrq	$63, %rax
	sarq	$38, %rsi
	addl	%eax, %esi
	movl	$.L.str.7, %edi
                                        # kill: def $esi killed $esi killed $rsi
	xorl	%eax, %eax
	callq	printf
	movq	368(%rsp), %rsi
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	movq	312(%rsp), %rsi
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	callq	printf
	movl	620(%rsp), %esi
	movl	$.L.str.10, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	640(%rsp), %esi
	movl	$.L.str.12, %edi
	xorl	%eax, %eax
	callq	printf
	movl	336(%rsp), %esi
	movl	$.L.str.13, %edi
	xorl	%eax, %eax
	callq	printf
	movl	340(%rsp), %esi
	movl	344(%rsp), %edx
	movl	348(%rsp), %ecx
	movl	$.L.str.14, %edi
	xorl	%eax, %eax
	callq	printf
	movl	352(%rsp), %esi
	movl	356(%rsp), %edx
	movl	360(%rsp), %ecx
	movl	$.L.str.15, %edi
	xorl	%eax, %eax
	callq	printf
	movl	320(%rsp), %esi
	movl	$.L.str.16, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	424(%rsp), %esi
	movl	$.L.str.18, %edi
	xorl	%eax, %eax
	callq	printf
	movl	436(%rsp), %esi
	movl	440(%rsp), %edx
	movl	$.L.str.19, %edi
	xorl	%eax, %eax
	callq	printf
	movl	472(%rsp), %esi
	movl	476(%rsp), %edx
	movl	480(%rsp), %ecx
	movl	$.L.str.20, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$10, %edi
	callq	putchar@PLT
	cmpl	12(%rsp), %ebp
	jl	.LBB1_5
	jmp	.LBB1_6
.LBB1_2:
	xorl	%ebx, %ebx
.LBB1_6:                                # %.loopexit
	movl	%ebx, %eax
	addq	$1488, %rsp                     # imm = 0x5D0
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.type	.L__const._Z12CudaGetCoresii.cores,@object # @__const._Z12CudaGetCoresii.cores
	.section	.rodata,"a",@progbits
	.p2align	4, 0x0
.L__const._Z12CudaGetCoresii.cores:
	.long	8                               # 0x8
	.long	8                               # 0x8
	.long	8                               # 0x8
	.long	8                               # 0x8
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	32                              # 0x20
	.long	48                              # 0x30
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	192                             # 0xc0
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	192                             # 0xc0
	.long	256                             # 0x100
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	0                               # 0x0
	.long	0                               # 0x0
	.size	.L__const._Z12CudaGetCoresii.cores, 96

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"ERROR: Couldn't find any CUDA devices.\n"
	.size	.L.str, 40

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"\nGPU #%d: '%s' @ %d MHz\n"
	.size	.L.str.1, 25

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"   Compute: %d.%d\n"
	.size	.L.str.2, 19

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"   Multi Processors: %d * %d Cores/SM = %d Cores\n"
	.size	.L.str.3, 50

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"   Total Memory : %lu MB (%lu bytes)\n"
	.size	.L.str.5, 38

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"   Bus Width    : %u-bit @ %d MHz ==> "
	.size	.L.str.6, 39

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"   Max Bandwidth: %u GB/s\n"
	.size	.L.str.7, 27

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"   Const memory : %lu (bytes)\n"
	.size	.L.str.8, 31

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"   Memory/Block : %lu\n"
	.size	.L.str.9, 23

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"   Unified mem  : %d\n"
	.size	.L.str.10, 22

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"   Max Threads/SM : %d \n"
	.size	.L.str.12, 25

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"   Threads / Block: %d\n"
	.size	.L.str.13, 24

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"   Max Thread Size: %d, %d, %d\n"
	.size	.L.str.14, 32

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"   Max Grid size  : %u, %u, %u\n"
	.size	.L.str.15, 32

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"   Registers/Block: %d\n"
	.size	.L.str.16, 24

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"   Texture Size 1D: %d          \n"
	.size	.L.str.18, 34

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"   Texture Size 2D: %d x %d     \n"
	.size	.L.str.19, 34

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"   Texture Size 3D: %d x %d x %d\n"
	.size	.L.str.20, 34

	.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	"\n=== Memory ==="
	.size	.Lstr, 16

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"\n=== Threads ==="
	.size	.Lstr.1, 17

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"\n=== Texture ==="
	.size	.Lstr.2, 17

	.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
