2 Replies Latest reply on Sep 25, 2015 10:57 AM by r.potter

    Finalizing HSA kernels with global variable declarations

    r.potter

      I have a kernel that declares but not defines a global variable that is intended to be shared between CPU and GPU, with the aim of using hsa_executable_global_variable_define() to associate global_var with an existing variable in CPU code.

       

      decl prog global_u32 &global_var;

       

      prog kernel &class_write_global_kernel(kernarg_u64 %f)

      {

        st_global_align(4)_u32 1, [&global_var];

        ret;

      };

       

      This causes a segfault in hsa_ext_program_finalize(). If I include the definition of the variable in the kernel (i.e. prog global_u32 &global_var) then the kernel finalizes successfully, but that approach prevents me from using hsa_executable_global_variable_define().