Skip to content

[Bug]: hip doesn't detect current device #102

Backlog

Description

@OneOfOne

Version or commit

4b3f44b

Environment

OS: CachyOS
GPU: 7900XTX
Mesa: 26.3.1
ROCM: 10.1

Steps to reproduce

  1. run with with --backend hip

Expected behavior

  • Detect hip device

Actual behavior

  • GPU 0: hipInit: no ROCm-capable device is detected; running without it

Additional logs or context

No response

Activity

  1. Vasyl-Trefilov commented on Nov 25, 2026

    @Vasyl-Trefilov
    Member

    Hi, ty for the report. Sadly I can't see the cause from here, the error comes from hipInit, which is the very first ROCm call. Can you send the output of rocminfo and of ls -l /dev/kfd /dev/dri, and tell me if your user is in the render and video groups? Next release also prints a small hint about this

  2. OneOfOne commented on Nov 25, 2026

    @OneOfOne
    Author

    I can confirm I'm in video and render groups, also:

    ❯ rocminfo
    ROCk module is loaded
    =====================    
    HSA System Attributes    
    =====================    
    Runtime Version:         1.21
    Runtime Ext Version:     1.32
    System Timestamp Freq.:  1000.000000MHz
    Sig. Max Wait Duration:  18446744073709551615 (0xFFFFFFFFFFFFFFFF) (timestamp count)
    Machine Model:           LARGE                              
    System Endianness:       LITTLE                             
    Mwaitx:                  ENABLED
    XNACK enabled:           NO
    DMAbuf Support:          YES
    VMM Support:             YES
    Fabric Support:          NO
    
    ==========               
    HSA Agents               
    ==========               
    *******                  
    Agent 1                  
    *******                  
      Name:                    AMD Ryzen 9 7950X3D 16-Core Processor
      Uuid:                    CPU-XX                             
      Marketing Name:          AMD Ryzen 9 7950X3D 16-Core Processor
      Vendor Name:             CPU                                
      Feature:                 None specified                     
      Profile:                 FULL_PROFILE                       
      Float Round Mode:        NEAR                               
      Max Queue Number:        0(0x0)                             
      Queue Min Size:          0(0x0)                             
      Queue Max Size:          0(0x0)                             
      Queue Type:              MULTI                              
      Node:                    0                                  
      Device Type:             CPU                                
      Cache Info:              
        L1:                      32768(0x8000) KB                   
      Chip ID:                 0(0x0)                             
      ASIC Revision:           0(0x0)                             
      Cacheline Size:          64(0x40)                           
      Max Clock Freq. (MHz):   5763                               
      BDFID:                   0                                  
      Internal Node ID:        0                                  
      Compute Unit:            32                                 
      SIMDs per CU:            0                                  
      Shader Engines:          0                                  
      Shader Arrs. per Eng.:   0                                  
      WatchPts on Addr. Ranges:1                                  
      Memory Properties:       
      Features:                None
      Pool Info:               
        Pool 1                   
          Segment:                 GLOBAL; FLAGS: FINE GRAINED        
          Size:                    131243896 (0x7d29f78) KB           
          Allocatable:             TRUE                               
          Alloc Granule:           4KB                                
          Alloc Recommended Granule:4KB                                
          Alloc Alignment:         4KB                                
          Accessible by all:       TRUE                               
        Pool 2                   
          Segment:                 GLOBAL; FLAGS: EXTENDED FINE GRAINED
          Size:                    131243896 (0x7d29f78) KB           
          Allocatable:             TRUE                               
          Alloc Granule:           4KB                                
          Alloc Recommended Granule:4KB                                
          Alloc Alignment:         4KB                                
          Accessible by all:       TRUE                               
        Pool 3                   
          Segment:                 GLOBAL; FLAGS: KERNARG, FINE GRAINED
          Size:                    131243896 (0x7d29f78) KB           
          Allocatable:             TRUE                               
          Alloc Granule:           4KB                                
          Alloc Recommended Granule:4KB                                
          Alloc Alignment:         4KB                                
          Accessible by all:       TRUE                               
        Pool 4                   
          Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
          Size:                    131243896 (0x7d29f78) KB           
          Allocatable:             TRUE                               
          Alloc Granule:           4KB                                
          Alloc Recommended Granule:4KB                                
          Alloc Alignment:         4KB                                
          Accessible by all:       TRUE                               
      ISA Info:                
    *******                  
    Agent 2                  
    *******                  
      Name:                    gfx1100                            
      Uuid:                    GPU-d804326794b07658               
      Marketing Name:          AMD Radeon RX 7900 XTX             
      Vendor Name:             AMD                                
      Feature:                 KERNEL_DISPATCH                    
      Profile:                 BASE_PROFILE                       
      Float Round Mode:        NEAR                               
      Max Queue Number:        128(0x80)                          
      Queue Min Size:          64(0x40)                           
      Queue Max Size:          131072(0x20000)                    
      Queue Type:              MULTI                              
      Node:                    1                                  
      Device Type:             GPU                                
      Cache Info:              
        L1:                      32(0x20) KB                        
        L2:                      6144(0x1800) KB                    
        L3:                      98304(0x18000) KB                  
      Chip ID:                 29772(0x744c)                      
      ASIC Revision:           0(0x0)                             
      Cacheline Size:          128(0x80)                          
      Max Clock Freq. (MHz):   2482                               
      BDFID:                   768                                
      Internal Node ID:        1                                  
      Compute Unit:            96                                 
      SIMDs per CU:            2                                  
      Shader Engines:          6                                  
      Shader Arrs. per Eng.:   2                                  
      WatchPts on Addr. Ranges:4                                  
      Coherent Host Access:    FALSE                              
      Memory Properties:       
      Features:                KERNEL_DISPATCH 
      Fast F16 Operation:      TRUE                               
      Wavefront Size:          32(0x20)                           
      Workgroup Max Size:      1024(0x400)                        
      Workgroup Max Size per Dimension:
        x                        1024(0x400)                        
        y                        1024(0x400)                        
        z                        1024(0x400)                        
      Max Waves Per CU:        32(0x20)                           
      Max Work-item Per CU:    1024(0x400)                        
      Grid Max Size:           2147483647(0x7fffffff)             
      Grid Max Size per Dimension:
        x                        2147483647(0x7fffffff)             
        y                        65535(0xffff)                      
        z                        65535(0xffff)                      
      Max fbarriers/Workgrp:   32                                 
      Packet Processor uCode:: 632                                
      SDMA engine uCode::      27                                 
      IOMMU Support::          None                               
      Pool Info:               
        Pool 1                   
          Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
          Size:                    25149440 (0x17fc000) KB            
          Allocatable:             TRUE                               
          Alloc Granule:           4KB                                
          Alloc Recommended Granule:2048KB                             
          Alloc Alignment:         4KB                                
          Accessible by all:       FALSE                              
        Pool 2                   
          Segment:                 GLOBAL; FLAGS: EXTENDED FINE GRAINED
          Size:                    25149440 (0x17fc000) KB            
          Allocatable:             TRUE                               
          Alloc Granule:           4KB                                
          Alloc Recommended Granule:2048KB                             
          Alloc Alignment:         4KB                                
          Accessible by all:       FALSE                              
        Pool 3                   
          Segment:                 GROUP                              
          Size:                    64 (0x40) KB                       
          Allocatable:             FALSE                              
          Alloc Granule:           0KB                                
          Alloc Recommended Granule:0KB                                
          Alloc Alignment:         0KB                                
          Accessible by all:       FALSE                              
      ISA Info:                
        ISA 1                    
          Name:                    amdgcn-amd-amdhsa--gfx1100         
          Machine Models:          HSA_MACHINE_MODEL_LARGE            
          Profiles:                HSA_PROFILE_BASE                   
          Default Rounding Mode:   NEAR                               
          Default Rounding Mode:   NEAR                               
          Fast f16:                TRUE                               
          Workgroup Max Size:      1024(0x400)                        
          Workgroup Max Size per Dimension:
            x                        1024(0x400)                        
            y                        1024(0x400)                        
            z                        1024(0x400)                        
          Grid Max Size:           18446744073709551615 (0xffffffffffffffff) 
          Grid Max Size per Dimension:
            x                        2147483647(0x7fffffff)             
            y                        65535(0xffff)                      
            z                        65535(0xffff)                      
          FBarrier Max Size:       32                                 
        ISA 2                    
          Name:                    amdgcn-amd-amdhsa--gfx11-generic   
          Machine Models:          HSA_MACHINE_MODEL_LARGE            
          Profiles:                HSA_PROFILE_BASE                   
          Default Rounding Mode:   NEAR                               
          Default Rounding Mode:   NEAR                               
          Fast f16:                TRUE                               
          Workgroup Max Size:      1024(0x400)                        
          Workgroup Max Size per Dimension:
            x                        1024(0x400)                        
            y                        1024(0x400)                        
            z                        1024(0x400)                        
          Grid Max Size:           18446744073709551615 (0xffffffffffffffff) 
          Grid Max Size per Dimension:
            x                        2147483647(0x7fffffff)             
            y                        65535(0xffff)                      
            z                        65535(0xffff)                      
          FBarrier Max Size:       32                                 
    *** Done ***             
    ❯ ls -l /dev/kfd /dev/dri
    crw-rw-rw- 1 root render 239, 0 Nov 22 14:56 /dev/kfd
    
    /dev/dri:
    total 0
    drwxr-xr-x  2 root root         80 Nov 22 14:56 by-path/
    crw-rw----+ 1 root video  226,   1 Nov 25 11:48 card1
    crw-rw-rw-  1 root render 226, 128 Nov 22 14:56 renderD128
    ❯ cat /dev/kfd
    cat: /dev/kfd: Invalid argument # can read the file
    
  3. OneOfOne commented on Nov 25, 2026

    @OneOfOne
    Author

    Fixed that issue, it was my jail script not passing /dev/kfd.

    got a new issue:

    loading Inkling-2-Mini-UD-Q4_K_XL.gguf
    page cache: reading 16813 MB of Inkling-2-Mini-UD-Q4_K_XL.gguf in the background (it shows as buff/cache, not as used memory)
    hip: AMD Radeon RX 7900 XTX (gfx1100, wave32, 65536 B shared memory a block)
    compiling HIP kernels for gfx1100 with hiprtc 9.0 (first run only)
    page cache: reading 16813 MB of Inkling-2-Mini-UD-Q4_K_XL.gguf in the background (it shows as buff/cache, not as used memory)
    hip: AMD Radeon RX 7900 XTX (gfx1100, wave32, 65536 B shared memory a block)
    loaded Inkling-2-Mini-UD-Q4_K_XL
    request: POST /v1/chat/completions key=open model=Inkling-2-Mini-UD-Q4_K_XL messages=5 stream=true tools=0
    inkling2: GPU prefill failed (hip: Inkling 2 batched conv not implemented); falling back to host chunk path
    

    then it just dies, no other errors at all, it exits with code 0 so it doesn't crash, it just exits.

  4. Vasyl-Trefilov commented on Nov 26, 2026

    @Vasyl-Trefilov
    Member

    Ty for finding the /dev/kfd thing! The new one is on my side: the HIP backend does not have the Inkling 2 kernels yet, only the main engine ones, so the GPU path fails and it goes to the CPU. I tried the same fallback on CUDA and there it keeps working (slow, but it answers), so the quiet exit with code 0 is strange. Can you check dmesg for an OOM kill and send what echo $? says right after it dies? For now please try --backend vulkan, on a 7900 XTX with RADV Inkling 2 should run fully on the card. I will add the Inkling 2 kernels to HIP, they are the same kernels.cu so it is mostly wiring, but I have no AMD card to test it, so I will ask you to try it when it is ready.

  5. OneOfOne commented on Nov 26, 2026

    @OneOfOne
    Author

    Ok, so using latest git (3920b2c), it doesn't exit, it prints this and uses the CPU, there's nothing in dmesg.

    [12:25:21] listening on http://0.0.0.0:10601/ (models folder: /home/oneofone/.local/share/rusting_strata/models)
    [12:25:30] loading /home/oneofone/.cache/huggingface/hub/models--unsloth--Inkling-2-Mini-GGUF/snapshots/8078d149286eec7193795413b9e0643da6d11fa1/Inkling-2-Mini-UD-Q4_K_XL.gguf
    [12:25:30] page cache: reading 16813 MB of Inkling-2-Mini-UD-Q4_K_XL.gguf in the background (it shows as buff/cache, not as used memory)
    [12:25:30] hip: AMD Radeon RX 7900 XTX (gfx1100, wave32, 65536 B shared memory a block)
    [12:25:30] compiling HIP kernels for gfx1100 with hiprtc 9.0 (first run only)
    [12:25:31] page cache: reading 16813 MB of Inkling-2-Mini-UD-Q4_K_XL.gguf in the background (it shows as buff/cache, not as used memory)
    [12:25:31] warning: 'inkling2_loop' models have no MTP drafts: --mtp and --mtp-model are ignored
    [12:25:31] hip: AMD Radeon RX 7900 XTX (gfx1100, wave32, 65536 B shared memory a block)
    [12:25:31] compiling HIP kernels for gfx1100 with hiprtc 9.0 (first run only)
    [12:25:31] GPU 0: hiprtc (gfx1100): HIPRTC_ERROR_COMPILATION
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:1564:36: error: no matching function for call to '__ldcg'
     1564 |                 if (z < ks) p[z] = __ldcg((const float4*)(part + (size_t)z * nd * y_stride + (size_t)r * y_stride + n));
          |                                    ^~~~~~
    /tmp/comgr-1147298-1-c2019c/include/hiprtc_runtime.h:13349:39: note: candidate function not viable: no known conversion from 'const float4 *' (aka 'const HIP_vector_type<float, 4> *') to 'const __half *' for 1st argument
     13349 | inline __attribute__((device)) __half __ldcg(const __half* ptr) { return *ptr; }
           |                                       ^      ~~~~~~~~~~~~~~~~~
    /tmp/comgr-1147298-1-c2019c/include/hiprtc_runtime.h:13354:40: note: candidate function not viable: no known conversion from 'const float4 *' (aka 'const HIP_vector_type<float, 4> *') to 'const __half2 *' for 1st argument
     13354 | inline __attribute__((device)) __half2 __ldcg(const __half2* ptr) { return *ptr; }
           |                                        ^      ~~~~~~~~~~~~~~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3164:29: error: use of undeclared identifier 'TQ_KBITS'
     3164 | template <int M, int BITS = TQ_KBITS>
          |                             ^~~~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3225:22: error: use of undeclared identifier 'K_MODE'
     3225 |         kv_store_one<K_MODE, TQ_KBITS>(kc, (size_t)pos * n + i, hd, k[i], 1.0f);
          |                      ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3226:22: error: use of undeclared identifier 'V_MODE'
     3226 |         kv_store_one<V_MODE, TQ_VBITS>(vc, (size_t)pos * n + i, hd, v[i], 1.0f);
          |                      ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3359:22: error: use of undeclared identifier 'K_MODE'
     3359 |         kv_store_one<K_MODE, TQ_KBITS>(kc, e + j, n, o[j], 1.0f);
          |                      ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3360:22: error: use of undeclared identifier 'V_MODE'
     3360 |         kv_store_one<V_MODE, TQ_VBITS>(vc, e + j, n, vr[j], 1.0f);
          |                      ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3381:38: error: use of undeclared identifier 'TQ_KBITS'
     3381 | template <int M, int PER, int BITS = TQ_KBITS> __attribute__((device)) inline __attribute__((always_inline)) void ldkv(const u16* c, size_t off, int hd, unsigned* o) {
          |                                      ^~~~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3483:29: error: use of undeclared identifier 'TQ_KBITS'
     3483 | template <int M, int BITS = TQ_KBITS> __attribute__((device)) inline __attribute__((always_inline)) float ldkv1(const u16* c, size_t off, int hd) {
          |                             ^~~~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3563:38: error: use of undeclared identifier 'K_MODE'
     3563 |             if (active) kv_store_one<K_MODE, TQ_KBITS>(dst, dat, w, v, 1.0f);
          |                                      ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3569:38: error: use of undeclared identifier 'V_MODE'
     3569 |             if (active) kv_store_one<V_MODE, TQ_VBITS>(dst, dat, w, v, 1.0f);
          |                                      ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3606:64: error: use of undeclared identifier 'K_MODE'
     3606 |         for (int c = lane; c < hd; c += 32) d += qs[c] * ldkv1<K_MODE, TQ_KBITS>(k, ko + c, hd);
          |                                                                ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3620:64: error: use of undeclared identifier 'V_MODE'
     3620 |     for (int j = t / hd; j < n; j += parts) a += ps[j] * ldkv1<V_MODE, TQ_VBITS>(v, (size_t)(i0 + j) * kw + kh * hd + c, hd);
          |                                                                ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3796:58: error: use of undeclared identifier 'K_MODE'
     3796 |         for (int j = 0; j < PER; j++) s += qv[j] * ldkv1<K_MODE, TQ_KBITS>(kbuf, kbase + kidx(j), HD);
          |                                                          ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3811:58: error: use of undeclared identifier 'V_MODE'
     3811 |         for (int j = 0; j < PER; j++) acc[j] = e * ldkv1<V_MODE, TQ_VBITS>(vbuf, kbase + vidx(j), HD) + acc[j] * c;
          |                                                          ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:4054:21: error: no matching function for call to 'ldkv1'
     4054 |             sk[i] = ldkv1<0>(use_new ? kc_new : kc, off, HD);
          |                     ^~~~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3483:107: note: candidate template ignored: couldn't infer template argument 'BITS'
     3483 | template <int M, int BITS = TQ_KBITS> __attribute__((device)) inline __attribute__((always_inline)) float ldkv1(const u16* c, size_t off, int hd) {
          |                                                                                                           ^
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:4055:21: error: no matching function for call to 'ldkv1'
     4055 |             sv[i] = ldkv1<0>(use_new ? vc_new : vc, off, HD);
          |                     ^~~~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:3483:107: note: candidate template ignored: couldn't infer template argument 'BITS'
     3483 | template <int M, int BITS = TQ_KBITS> __attribute__((device)) inline __attribute__((always_inline)) float ldkv1(const u16* c, size_t off, int hd) {
          |                                                                                                           ^
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:4239:22: error: use of undeclared identifier 'K_MODE'
     4239 |                 ldkv<K_MODE, PER, TQ_KBITS>(kc, r, hd, kr[j]); ldkv<V_MODE, PER, TQ_VBITS>(vc, r, hd, vr[j]);
          |                      ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:4239:69: error: use of undeclared identifier 'V_MODE'
     4239 |                 ldkv<K_MODE, PER, TQ_KBITS>(kc, r, hd, kr[j]); ldkv<V_MODE, PER, TQ_VBITS>(vc, r, hd, vr[j]);
          |                                                                     ^~~~~~
    /tmp/comgr-1147298-1-c2019c/input/kernels.cu:4368:1208: error: use of undeclared identifier 'K_MODE'
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated when compiling for gfx1100.; running without it
    [12:25:32] loaded Inkling-2-Mini-UD-Q4_K_XL
    [12:25:36] request: POST /v1/chat/completions key=open model=Inkling-2-Mini-UD-Q4_K_XL messages=3 stream=true tools=0
    [12:25:47] prefill: 55.2 tok/s, 512 tok
    [12:25:55] prefill: 54.8 tok/s, 1024 tok
    [12:26:05] prefill: 54.4 tok/s, 1536 tok
    [12:26:15] prefill: 54.1 tok/s, 2048 tok
    [12:26:25] prefill: 53.8 tok/s, 2560 tok
    [12:26:35] prefill: 53.8 tok/s, 3072 tok
    [12:26:43] prefill: 53.7 tok/s, 3584 tok
    

    vulkan works great.

    I'll be happy to test!

    Also thank you very much for the great project.

  6. Vasyl-Trefilov commented on Nov 26, 2026

    @Vasyl-Trefilov
    Member

    thanks a lot, this is very useful, i don't have a x4 + x16 pair so these numbers help. one thing: 1.3.7 does not have the inkling 2 two-card change yet (expert slabs on the second card, #96), so your 0,1 and 1,0 numbers are the old split. it is in 1.4.0 now, if you have time could you run the same bench again with --device 0,1 and 1,0? also fixed the nvrtc thing you found: 1.4.0 looks for libnvrtc.so.13 and libnvrtc.alt.so too, so STRATA_NVRTC is not needed anymore.

  7. OneOfOne commented on Nov 26, 2026

    @OneOfOne
    Author

    I only have one device not two, and I don't have nvrtc (that's an nvidia thing I'm assuming?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions