ROCm / HIP-Examples

Examples for HIP
194 stars 86 forks source link

###Segfault with hipcc #35

Open BA-ahmed opened 2 years ago

BA-ahmed commented 2 years ago

We tried to run and execute a sample example using hipcc compiler in an AWS instance. The sample fails to run with a Segmentation fault.

Any suggestions would be helpful

Steps followed

1. Clone the HIP examples git clone https://github.com/ROCm-Developer-Tools/HIP-Examples.git

2. Export Variables

export ROCM_PATH=/opt/rocm
export PATH=/opt/rocm/bin:$PATH 
 export LD_LIBRARY_PATH=/opt/rocm-5.0.0/hsa/lib:$LD_LIBRARY_PATH
export HIPCC_COMPILE_FLAGS_APPEND="-save-temps"
export HIPCC_VERBOSE=7

3. Sample test Execution

ubuntu@ip-172-31-16-166:~/HIP/examples$ cd HIP-Examples/vectorAdd/
ubuntu@ip-172-31-16-166:~/HIP/examples/HIP-Examples/vectorAdd$
ubuntu@ip-172-31-16-166:~/HIP/hip-testsuite/HIP-Examples/vectorAdd$ make
./vectoradd_hip.exe
 System minor 0
 System major 20
 agent prop name
hip Device prop succeeded
Makefile:30: recipe for target 'test' failed
make: *** [test] Segmentation fault (core dumped)

4. Try to execute sample test via command line

ubuntu@ip-172-31-16-166:~/HIP/hip-testsuite/HIP-Examples/vectorAdd$ hipcc  vectoradd_hip.cpp
HIP_PATH=/opt/rocm/hip
HIP_PLATFORM=amd
HIP_COMPILER=clang
HIP_RUNTIME=rocclr
ROCM_PATH=/opt/rocm
HIP_ROCCLR_HOME=/opt/rocm/hip
HIP_CLANG_PATH=/opt/rocm/llvm/bin
HIP_CLANG_INCLUDE_PATH=/opt/rocm-5.0.0/llvm/lib/clang/14.0.0/include
HIP_INCLUDE_PATH=/opt/rocm/hip/include
HIP_LIB_PATH=/opt/rocm/hip/lib
DEVICE_LIB_PATH=/opt/rocm/amdgcn/bitcode
HIP_CLANG_TARGET=1
hipcc-args: vectoradd_hip.cpp
hipcc-cmd: /opt/rocm/llvm/bin/clang++  -std=c++11 -isystem "/opt/rocm-5.0.0/llvm/lib/clang/14.0.0/include/.." -isystem /opt/rocm/hsa/include -isystem "/opt/rocm/hip/include" --offload-arch=gfx1011 -O3 -mllvm -amdgpu-early-inline-all=true -mllvm -amdgpu-function-calls=false -fhip-new-launch-api -save-temps  -L"/opt/rocm/hip/lib" -O3 -lgcc_s -lgcc -lpthread -lm -lrt  -Wl,--enable-new-dtags -Wl,-rpath=/opt/rocm/hip/lib:/opt/rocm/lib -lamdhip64  -x hip vectoradd_hip.cpp -L/opt/rocm/llvm/bin/../lib/clang/14.0.0/lib/linux -lclang_rt.builtins-x86_64

3. Run executable

ubuntu@ip-172-31-16-166:~/HIP/hip-testsuite/HIP-Examples/vectorAdd$ ls
Makefile                                         vectoradd_hip-hip-amdgcn-amd-amdhsa-gfx1011.out                 vectoradd_hip-host-x86_64-unknown-linux-gnu.s
README                                           vectoradd_hip-hip-amdgcn-amd-amdhsa-gfx1011.out.resolution.txt  vectoradd_hip.cpp
a.out                                            vectoradd_hip-hip-amdgcn-amd-amdhsa-gfx1011.s                   vectoradd_hip.cpp-hip-amdgcn-amd-amdhsa.hipfb
vectoradd_hip-hip-amdgcn-amd-amdhsa-gfx1011.bc   vectoradd_hip-host-x86_64-unknown-linux-gnu.bc                  vectoradd_hip.exe
vectoradd_hip-hip-amdgcn-amd-amdhsa-gfx1011.cui  vectoradd_hip-host-x86_64-unknown-linux-gnu.cui                 vectoradd_hip.o
vectoradd_hip-hip-amdgcn-amd-amdhsa-gfx1011.o    vectoradd_hip-host-x86_64-unknown-linux-gnu.o

ubuntu@ip-172-31-16-166:~/HIP/hip-testsuite/HIP-Examples/vectorAdd$ ./a.out
 System minor 0
 System major 20
 agent prop name  ▒▒
hip Device prop succeeded
Segmentation fault (core dumped)

Environment Details

ubuntu@ip-172-31-16-166:~$ /opt/rocm-5.0.0/bin/rocminfo | less

===================== HSA System Attributes

Runtime Version: 1.1 System Timestamp Freq.: 1000.000000MHz Sig. Max Wait Duration: 18446744073709551615 (0xFFFFFFFFFFFFFFFF) (timestamp count) Machine Model: LARGE System Endianness: LITTLE

========== HSA Agents


Agent 1


Name: AMD EPYC 7R32 Uuid: CPU-XX Marketing Name: AMD EPYC 7R32 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) Cacheline Size: 64(0x40) Max Clock Freq. (MHz): 0 BDFID: 0 Internal Node ID: 0 Compute Unit: 16 SIMDs per CU: 0 Shader Engines: 0 Shader Arrs. per Eng.: 0


Agent 2


Name: gfx1011 Uuid: GPU-XX Marketing Name: AMD Radeon Pro V520 MxGPU Vendor Name: AMD Feature: KERNEL_DISPATCH Profile: BASE_PROFILE Float Round Mode: NEAR Max Queue Number: 128(0x80) Queue Min Size: 4096(0x1000) Queue Max Size: 131072(0x20000) Queue Type: MULTI Node: 1 Device Type: GPU Cache Info: L1: 16(0x10) KB Chip ID: 29538(0x7362) Cacheline Size: 64(0x40) Max Clock Freq. (MHz): 1150 BDFID: 240 Internal Node ID: 1 Compute Unit: 36 SIMDs per CU: 4 Shader Engines: 4 Shader Arrs. per Eng.: 2 WatchPts on Addr. Ranges:4 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: 80(0x50) Max Work-item Per CU: 2560(0xa00) Grid Max Size: 4294967295(0xffffffff) Grid Max Size per Dimension: x 4294967295(0xffffffff) y 4294967295(0xffffffff)


### OS Info
ubuntu@ip-172-31-16-166:~/Examples/HIP-Examples/vectorAdd$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic