Forums - qnn-model-lib-generator fails

6 posts / 0 new
Last post
qnn-model-lib-generator fails
dk.zz79ya
Join Date: 7 Mar 24
Posts: 1
Posted: Fri, 2024-03-22 02:40

Hi Qualcomm guys,

I am trying to quantize and convert 3B Llama model for mobile device with Snapdragon 8 Gen 3, but I ended up being caught by an error while I was running 'qnn-model-lib-generator' tool.

With onnx model that I got with AIMET's calibration process as input, I ran `qnn-onnx-converter`. As a result, I got a pair of .cpp, and .bin files, so far so good.

However, when I tried to run `qnn-model-lib-generator` with the .cpp, .bin files as input, it stops running with the following error:

/usr/bin/../lib/gcc/x86_64-linux-gnu/9/crtbeginS.o: in function `deregister_tm_clones':
crtstuff.c:(.text+0x3): relocation truncated to fit: R_X86_64_PC32 against `.tm_clone_table'
crtstuff.c:(.text+0xa): relocation truncated to fit: R_X86_64_PC32 against symbol `__TMC_END__' defined in .data section in libs/x86_64-linux-clang/lib3B-26L_1_of_1.so
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/crtbeginS.o: in function `register_tm_clones':
crtstuff.c:(.text+0x33): relocation truncated to fit: R_X86_64_PC32 against `.tm_clone_table'
crtstuff.c:(.text+0x3a): relocation truncated to fit: R_X86_64_PC32 against symbol `__TMC_END__' defined in .data section in libs/x86_64-linux-clang/lib3B-26L_1_of_1.so
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/crtbeginS.o: in function `__do_global_dtors_aux':
crtstuff.c:(.text+0x76): relocation truncated to fit: R_X86_64_PC32 against `.bss'
crtstuff.c:(.text+0x9e): relocation truncated to fit: R_X86_64_PC32 against `.bss'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile.linux-x86_64:104: libs/x86_64-linux-clang/lib3B-26L_1_of_1.so] Error 1

I googled with the error message, but with so few clues, I couldn't get a fine solution for this.

Can anybody help me deal with this error?

 

 

 

  • Up0
  • Down0
sanjjey.a.sanjjey
Join Date: 17 May 22
Posts: 67
Posted: Thu, 2024-04-04 00:28

Hi,

can you share me the command you used for qnn-model-lib-generator.

 

  • Up0
  • Down0
2667199938
Join Date: 29 May 24
Posts: 6
Posted: Wed, 2024-05-29 00:19

```

(py310) PS C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc> python qnn-model-lib-generator -c C:\Users\26671\Desktop\Qualcomm\best.cpp -b C:\Users\26671\Desktop\Qualcomm\best.bin -t aarch64-android -o model_libs --clean_up

2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Model cpp file path  : C:\Users\26671\Desktop\Qualcomm\best.cpp
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Model bin file path  : C:\Users\26671\Desktop\Qualcomm\best.bin
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Library target       : [['aarch64-android']]
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Library name         : best
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Output directory     : model_libs
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Build type           : Release
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Clean-up             : True
Traceback (most recent call last):
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 488, in <module>
    main()
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 482, in main
    result = generator.build_targets(config)
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 386, in build_targets
    self._normalize_config(config)
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 374, in _normalize_config
    raise ValueError(f'Unsupported target(s): {",".join(invalid_targets)}')
ValueError: Unsupported target(s): aarch64-android
```
I feel like my version is too new to support aarch64 android

 

  • Up0
  • Down0
2667199938
Join Date: 29 May 24
Posts: 6
Posted: Wed, 2024-05-29 00:20

```

(py310) PS C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc> python qnn-model-lib-generator -c C:\Users\26671\Desktop\Qualcomm\best.cpp -b C:\Users\26671\Desktop\Qualcomm\best.bin -t aarch64-android -o model_libs --clean_up

2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Model cpp file path  : C:\Users\26671\Desktop\Qualcomm\best.cpp
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Model bin file path  : C:\Users\26671\Desktop\Qualcomm\best.bin
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Library target       : [['aarch64-android']]
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Library name         : best
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Output directory     : model_libs
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Build type           : Release
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Clean-up             : True
Traceback (most recent call last):
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 488, in <module>
    main()
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 482, in main
    result = generator.build_targets(config)
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 386, in build_targets
    self._normalize_config(config)
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 374, in _normalize_config
    raise ValueError(f'Unsupported target(s): {",".join(invalid_targets)}')
ValueError: Unsupported target(s): aarch64-android
```
I feel like my version is too new to support aarch64 android

 

  • Up0
  • Down0
2667199938
Join Date: 29 May 24
Posts: 6
Posted: Wed, 2024-05-29 00:20

```

(py310) PS C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc> python qnn-model-lib-generator -c C:\Users\26671\Desktop\Qualcomm\best.cpp -b C:\Users\26671\Desktop\Qualcomm\best.bin -t aarch64-android -o model_libs --clean_up

2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Model cpp file path  : C:\Users\26671\Desktop\Qualcomm\best.cpp
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Model bin file path  : C:\Users\26671\Desktop\Qualcomm\best.bin
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Library target       : [['aarch64-android']]
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Library name         : best
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Output directory     : model_libs
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Build type           : Release
2024-05-29 15:13:49,528 -    INFO - qnn-model-lib-generator: Clean-up             : True
Traceback (most recent call last):
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 488, in <module>
    main()
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 482, in main
    result = generator.build_targets(config)
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 386, in build_targets
    self._normalize_config(config)
  File "C:\Qualcomm\AIStack\QAIRT\2.22.6.240515\bin\x86_64-windows-msvc\qnn-model-lib-generator", line 374, in _normalize_config
    raise ValueError(f'Unsupported target(s): {",".join(invalid_targets)}')
ValueError: Unsupported target(s): aarch64-android
```
I feel like my version is too new to support aarch64 android

 

  • Up0
  • Down0
sanjjey.a.sanjjey
Join Date: 17 May 22
Posts: 67
Posted: Wed, 2024-05-29 22:10

Hi,

Can you try once by exporting the android_ndk_root path. Follow the below given steps.

$ export ANDROID_NDK_ROOT=android-ndk-r21c 

$export PATH=${ANDROID_NDK_ROOT}:${PATH} 

${QNN_SDK_ROOT}/bin/envcheck -n 

 

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.