3 Replies Latest reply on May 12, 2015 10:49 PM by rtgllc

    Question about HSA-OpenMP-GCC-AMD

    rtgllc

      Hello again! Yesterday we built GCC from the hsa branch according to the rules given in the wiki:

       

      https://github.com/HSAFoundation/HSA-OpenMP-GCC-AMD/wiki

       

      Everything went rather smoothly until it came time to build the samples.  Using the appropriate environment variables, we get these errors:

       

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_region_get_info'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_init'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_signal_create'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_agent_iterate_regions'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_create'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_signal_store_relaxed'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_get_symbol'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_add_module'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_signal_wait_acquire'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_destroy'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_memory_allocate'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_status_string'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_iterate_agents'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_finalize'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_create'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_agent_get_info'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_queue_create'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_freeze'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_queue_add_write_index_relaxed'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_symbol_get_info'

      /home/drmrlordx/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_load_code_object'


      We're pretty sure that's from the second sample, matrixMultiply, though vectorCopy produces similar results.  Testing confirms that we have Okra and the HSA Runtime samples running correctly (Squares and vector_copy, respectively).  Does this have something to do with the fact that Okra is still dependent on an old version of the HSA Runtime? Or is something else going on here? Thanks!

        • Re: Question about HSA-OpenMP-GCC-AMD
          rtgllc

          Some clarification: apparently it is a linker problem.  Gcc couldn't find some .so files.  So we modified the makefile and produced what follows:

           

          GCCHSAIL=$(GCC_HSA)/bin/gcc
          LDFLAGS
          =-lhsa-runtime64 -lhsa-runtime-ext64 -lhsakmt -L $(GCC_HSA)/lib64 -L ~/HSA-Runtime-AMD-master/lib -L opt/hsa/lib -L ~/libhsakmt/build/lnx64a -Wl,-rpath,$(GCC_HSA)/lib64 
          CFLAGS
          =-lm -fopenmp -Wall -O3
          all
          : matmul
          clean
          :
            rm
          -rf *.o matmul test.output
          # GCC Specifics
          matmul
          .o :  matmul.c
            $
          (GCCHSAIL) -c $(CFLAGS) $<
          matmul
          : matmul.o
            $
          (GCCHSAIL) matmul.o $(CFLAGS) -o $@ $(LDFLAGS
          )


          Showing the compiler the exact locations of libhsa-runtime64.so, libhsa-runtime-ext64.so, and libhsakmt.so eliminated some of the errors, but not all of them.  Now we get the following errors:


          /hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_add_module'
          /hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_symbol_get_info'
          /hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_load_code_object'
          /hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_freeze'
          /hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_create'
          /hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_get_symbol'
          /hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_finalize'


          We haven't been able to nail down what else might be missing here, or exactly what's wrong.  Is it a problem that we're using an older version of the runtime to maintain compatibility with Okra? Nothing Okra-dependent works with the 1.0F runtime.

            • Re: Question about HSA-OpenMP-GCC-AMD
              grodgers

              rtgllc,

               

              Thanks for testing gcc hsa branch.   This is in active development and you got burned by the recent update to HSA 1.0F and the elimimation of Okra.   This new update needs HSA 1.0F kernel and runtime.   I did a first pass update to the wiki at.

               

              https://github.com/HSAFoundation/HSA-OpenMP-GCC-AMD/wiki

               

              You will notice that the updates no longer need okra.  The problems you are having is that the update uses the updated HSA 1.0F API.   I am also going to be testing this update and testing the install instructions.  We are moving to OpenMP4 support but that will take some time.  Watch for updates to the hsa branch and updates to this wiki.  This repository is to manage test cases as development continues.

               

              Greg

                • Re: Question about HSA-OpenMP-GCC-AMD
                  rtgllc

                  Ah ha, that explains everything.  We'll update the runtime and driver components as necessary and try again.  It is fortunate that we do not need Okra on that partition anymore, now that we have more-or-less given up on trying to get what is left of Project Sumatra to function.

                   

                  Is Okra eliminated completely, or are there still some HSA projects in active development that plan to continue its use?

                   

                  edit: The new driver components (we're using mainline kernel 3.19, so we just updated the firmware to 396 and updated libhsakmt) and new runtime worked perfectly, though we discovered that there is another package that the samples require: libdwarf.  We had to provide another -l switch (-ldwarf) to the LDFLAGS line in the makefiles to get the samples to build properly.  They run just fine now.