CUDA::Minimal, back where it should be (but why did it break?)
I just posted an entry about how CUDA::Minimal was behaving weirdly. I hadn't dug around to figure out what was going on, and I went so far as to modify the way the code was compiled and linked to get it to work! My previous post raised concerns about how I would continue with the newly-chosen path.
Well, I decided that I should really figure out what was giving trouble. After many hours (and staying up later than I ought), I figured it out. I highly suspect that these problems are due to interactions with C macros defined by nVidia, but I'm not sure. I'm going to post them here, and possibly also the the perl-xs mailing list, in hopes that they might help somebody solve problems.
There were two big changes. First, all XS code that uses ExtUtils::nvcc has to include this in their boot sections:
BOOT: #undef PERL_VERSION #define PERL_VERSION 0
Why? Because this generated C code that came later in the
BOOT section was causing segfaults:
#if (PERL_REVISION == 5 && PERL_VERSION >= 9) if (PL_unitcheckav) call_list(PL_scopestack_ix, PL_unitcheckav);
Second, in order to get the address of the pointer value part of a scalar, I use
sv_2pvbyte_nolen. I originally used
SvPVX (having verified that he slot existed), but that started to return nil in this new compilation setup. I also tried using
SvPVbyte_nolen, but that also returned nil. The perlapi docs for
sv_2pvbyte_nolen state this function is "Usually accessed via the SvPVbyte_nolen macro," but I can't figure out if there's anything bad with using
You might ask why I don't file these on perlbug. Like I said, I'm not sure if these are bugs with Perl, or with the Perl-nvcc interactions. If it's the latter, I'm not so worried about them, and I'd rather at least begin by finding and documenting these troubles. I'll try to fix them if they really start giving trouble. If you have any ideas for what is going on or want me to try something to figure it out, feel free to respond here, or file a bug report on CUDA::Minimal.
And with that, I'm going to get my play-perl points. :-)