diff --git a/Basic/Primitive/primitive.pd b/Basic/Primitive/primitive.pd index fa332b97c..0c61cf1b6 100644 --- a/Basic/Primitive/primitive.pd +++ b/Basic/Primitive/primitive.pd @@ -213,51 +213,50 @@ sub PDL::matmult { } EOPM Code => <<'EOC', - PDL_Indx ih, iw, it, ow, oh, ot, wlim, hlim, tlim; - PDL_Indx tsiz = 8 * sizeof(double) / sizeof($GENERIC()); - - // Cache the dimincs to avoid constant lookups - PDL_Indx atdi = PDL_REPRINCS($PDL(a))[0]; - PDL_Indx btdi = PDL_REPRINCS($PDL(b))[1]; - - // Loop over tiles - for( oh=0; oh < $SIZE(h); oh += tsiz ) { - hlim = PDLMIN(oh + tsiz, $SIZE(h)); - - for( ow=0; ow < $SIZE(w); ow += tsiz ) { - wlim = PDLMIN(ow + tsiz, $SIZE(w)); - - // Zero the output for this tile - for( ih=oh; ihiw, h=>ih) = 0; - - for( ot=0; ot < $SIZE(t); ot += tsiz ) { - tlim = PDLMIN(ot + tsiz, $SIZE(t)); - - for( ih=oh; ihiw, h=>ih); - - // Cache data pointers before 't' run through tile - $GENERIC() *ad = &($a(t=>ot, h=>ih)); - $GENERIC() *bd = &($b(w=>iw, t=>ot)); - - // Hotspot - run the 't' summation - for( it=ot; itiw, h=>ih) = cc; - } - } - } - } - } +PDL_Indx ih, iw, it, ow, oh, ot, wlim, hlim, tlim; +PDL_Indx tsiz = 8 * sizeof(double) / sizeof($GENERIC()); + +// Cache the dimincs to avoid constant lookups +PDL_Indx atdi = PDL_REPRINCS($PDL(a))[0]; +PDL_Indx btdi = PDL_REPRINCS($PDL(b))[1]; + +broadcastloop %{ +// Loop over tiles +for( oh=0; oh < $SIZE(h); oh += tsiz ) { + hlim = PDLMIN(oh + tsiz, $SIZE(h)); + + for( ow=0; ow < $SIZE(w); ow += tsiz ) { + wlim = PDLMIN(ow + tsiz, $SIZE(w)); + + // Zero the output for this tile + for( ih=oh; ihiw, h=>ih) = 0; + + for( ot=0; ot < $SIZE(t); ot += tsiz ) { + tlim = PDLMIN(ot + tsiz, $SIZE(t)); + + for( ih=oh; ihiw, h=>ih); + // Cache data pointers before 't' run through tile + $GENERIC() *ad = &($a(t=>ot, h=>ih)); + $GENERIC() *bd = &($b(w=>iw, t=>ot)); + // Hotspot - run the 't' summation + for( it=ot; itiw, h=>ih) = cc; + } + } + } + } +} +%} EOC Doc => <<'EOD' =for ref