Rich Morin writes: : Some while back, I asked the Perk5-porters whether there were any : parts of Perl that could benefit from vector processors (e.g., the : G4 Velocity Engine). The consensus of the respondents ranged from : "probably not" to "I don't want to think about it".
Well, Perl 5 doesn't really support compact arrays of known size, and those are the only kind that are easy to think about when it comes to vectorization. : I think that better answers could have been found, given the right : motivation, but nobody was taking VPs seriously back then (the G4 : was seen as a small, niche machine). With booming sales of iMacs : and the advent of Mac OS X, however, the G4 is starting to look a : bit more real. : : Looking at some of Perl6 language features (e.g., hyperoperators : and Damian's Quantum magic), it seems like it might be time to ask : the question again. So: : : * What parts of Perl6 might benefit from a vector processor? Well, compact arrays of known size, either compact ints or floaters. : * Are there any language constructs (pragmas?) that might be : useful to add to enhance use of VPs? Not pragams, perhaps, but definitely things of a declarative nature. This sort of proposed declaration ought to vectorize easily: my num @a is dim(1024,1024) = init_a(); my num @b is dim(1024,1024) = init_b(); my num @c is dim(1024,1024); @c = @a ^* @b; Vectorizing compact arrays of indefinite size is probably the next easiest thing. Vectorizing noncompact arrays of scalars would be tricky, and really only doable if it could be guaranteed that all of the scalars in the array are of exactly the same form. Perl 5 certainly has no way of enforcing that, though it's possible Perl 6 could with sufficiently precise declaration. : * Is there an abstract model that could let Perl6 take advantage : of assorted VP architectures? Well, you really want to talk to the PDL folks there, I suspect. We're not necessarily trying to put all of the PDL abstractions into Perl 6, but we're most definitely trying to make it easy for the PDLers to warp Perl into the language of their dreams. Larry