https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97203
Alexander Monakov <amonakov at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amonakov at gcc dot gnu.org --- Comment #6 from Alexander Monakov <amonakov at gcc dot gnu.org> --- (In reply to Tom de Vries from comment #4) > So, I think calling functions from simd code is atm not supported for nvptx. > > Stack variables in simd code are mapped on a per-thread stack rather than on > the > usual per-warp stack. > > The functions are compiled with the usual per-warp stack, so calling those > functions from simd might mean the different lanes are gonna disagree about > what the value in a stack variable should be. This is inaccurate. In -msoft-stack mode there's no baked-in assumption that stacks are always per-warp. The "soft stack" pointer can point either to global memory (outside of SIMD regions), or to local memory (inside SIMD regions). The pointer is switched between per-warp global memory and per-lane local memory by nvptx.c:nvptx_output_softstack_switch. The main requirement is that functions callable from OpenMP offloaded code are compiled for -mgomp multilib variant. The design allows calling functions even from inside SIMD regions, and it should be supported. It is very disappointing that the first reaction was "I think ... is not supported" without reaching out and asking questions. Lack of efficient communication was a huge issue when OpenMP offloading support was contributed, and it's disappointing to see it again years later.