Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
Untitled diff
Créé
il y a 10 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
23 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
110 lignes
Copier tout
71 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
135 lignes
Copier tout
// Copyright (c) 2009-2011 Intel Corporation
// Copyright (c) 2009-2011 Intel Corporation
// All rights reserved.
// All rights reserved.
//
//
// WARRANTY DISCLAIMER
// WARRANTY DISCLAIMER
//
//
// THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE
// MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//
// Intel Corporation is the author of the Materials, and requests that all
// Intel Corporation is the author of the Materials, and requests that all
// problem reports or change requests be submitted to it directly
// problem reports or change requests be submitted to it directly
Copier
Copié
Copier
Copié
// https://software.intel.com/en-us/articles/bitonic-sorting
// Modified to sort int2 key-value array
Copier
Copié
Copier
Copié
__kernel void
/*__attribute__((vec_type_hint(int4)))*/
BitonicSort(__global int
4
* theArray,
__kernel void
BitonicSort(__global int
8
* theArray,
const uint stage,
const uint stage,
const uint passOfStage,
const uint passOfStage,
const uint dir)
const uint dir)
{
{
size_t i = get_global_id(0);
size_t i = get_global_id(0);
Copier
Copié
Copier
Copié
int
4
srcLeft, srcRight, mask;
int
8
srcLeft, srcRight, mask;
int4 pseudomask;
int4 imask10 = (int4)(0, 0, -1, -1);
int4 imask10 = (int4)(0, 0, -1, -1);
int4 imask11 = (int4)(0, -1, 0, -1);
int4 imask11 = (int4)(0, -1, 0, -1);
if(stage > 0)
if(stage > 0)
{
{
Copier
Copié
Copier
Copié
if(passOfStage > 0) // upper level pass, exchange between two fours,
operating on half size
if(passOfStage > 0) // upper level pass, exchange between two fours,
{
{
size_t r = 1 << (passOfStage - 1);
size_t r = 1 << (passOfStage - 1);
size_t lmask = r - 1;
size_t lmask = r - 1;
size_t left = ((i>>(passOfStage-1)) << passOfStage) + (i & lmask);
size_t left = ((i>>(passOfStage-1)) << passOfStage) + (i & lmask);
size_t right = left + r;
size_t right = left + r;
srcLeft = theArray[left];
srcLeft = theArray[left];
srcRight = theArray[right];
srcRight = theArray[right];
Copier
Copié
Copier
Copié
mask
= srcLeft
< srcRight
;
pseudomask
= srcLeft
.even
< srcRight
.even;
mask = pseudomask.xxyyzzww
;
Copier
Copié
Copier
Copié
int
4
imin = (srcLeft & mask) | (srcRight & ~mask);
int
8
imin = (srcLeft & mask) | (srcRight & ~mask);
int
4
imax = (srcLeft & ~mask) | (srcRight & mask);
int
8
imax = (srcLeft & ~mask) | (srcRight & mask);
if( ((i>>(stage-1)) & 1) ^ dir )
if( ((i>>(stage-1)) & 1) ^ dir )
{
{
theArray[left] = imin;
theArray[left] = imin;
theArray[right] = imax;
theArray[right] = imax;
}
}
else
else
{
{
theArray[right] = imin;
theArray[right] = imin;
theArray[left] = imax;
theArray[left] = imax;
}
}
}
}
Copier
Copié
Copier
Copié
else // last pass, sort inside one four
, operating on full size
else // last pass, sort inside one four
{
{
srcLeft = theArray[i];
srcLeft = theArray[i];
Copier
Copié
Copier
Copié
srcRight = srcLeft.
zwxy
;
srcRight = srcLeft.
s45670123
;
mask
= (srcLeft
< srcRight
) ^ imask10;
pseudomask
= (srcLeft
.even
< srcRight
.even
) ^ imask10;
mask = pseudomask.xxyyzzww;
if(((i >> stage) & 1) ^ dir)
if(((i >> stage) & 1) ^ dir)
{
{
srcLeft = (srcLeft & mask) | (srcRight & ~mask);
srcLeft = (srcLeft & mask) | (srcRight & ~mask);
Copier
Copié
Copier
Copié
srcRight = srcLeft.
yxwz
;
mask
= (srcLeft
< srcRight
) ^ imask11;
srcRight = srcLeft.
s23016745
;
pseudomask
= (srcLeft
.even
< srcRight
.even
) ^ imask11;
mask = pseudomask.xxyyzzww;
theArray[i] = (srcLeft & mask) | (srcRight & ~mask);
theArray[i] = (srcLeft & mask) | (srcRight & ~mask);
}
}
else
else
{
{
srcLeft = (srcLeft & ~mask) | (srcRight & mask);
srcLeft = (srcLeft & ~mask) | (srcRight & mask);
Copier
Copié
Copier
Copié
srcRight = srcLeft.
yxwz
;
mask
= (srcLeft
< srcRight
) ^ imask11;
srcRight = srcLeft.
s23016745
;
pseudomask
= (srcLeft
.even
< srcRight
.even
) ^ imask11;
mask = pseudomask.xxyyzzww;
theArray[i] = (srcLeft & ~mask) | (srcRight & mask);
theArray[i] = (srcLeft & ~mask) | (srcRight & mask);
}
}
}
}
}
}
else // first stage, sort inside one four
else // first stage, sort inside one four
{
{
int4 imask0 = (int4)(0, -1, -1, 0);
int4 imask0 = (int4)(0, -1, -1, 0);
srcLeft = theArray[i];
srcLeft = theArray[i];
Copier
Copié
Copier
Copié
srcRight = srcLeft.
yxwz;
srcRight = srcLeft.
s23016745;
mask = (srcLeft < srcRight) ^ imask0;
pseudomask = (srcLeft.even < srcRight.even) ^ imask0;
mask = pseudomask.xxyyzzww;
if( dir )
if( dir )
srcLeft = (srcLeft & mask) | (srcRight & ~mask);
srcLeft = (srcLeft & mask) | (srcRight & ~mask);
else
else
srcLeft = (srcLeft & ~mask) | (srcRight & mask);
srcLeft = (srcLeft & ~mask) | (srcRight & mask);
Copier
Copié
Copier
Copié
srcRight = srcLeft.
zwxy;
mask
= (srcLeft
< srcRight
) ^ imask10;
srcRight = srcLeft.
s45670123;
pseudomask
= (srcLeft
.even
< srcRight
.even
) ^ imask10;
mask = pseudomask.xxyyzzww;
if((i & 1) ^ dir)
if((i & 1) ^ dir)
{
{
Copier
Copié
Copier
Copié
srcLeft = (srcLeft & mask) | (srcRight & ~mask);
srcLeft = (srcLeft & mask) | (srcRight & ~mask);
Copier
Copié
Copier
Copié
srcRight = srcLeft.
yxwz
;
mask
= (srcLeft
< srcRight
) ^ imask11;
srcRight = srcLeft.
s23016745
;
pseudomask
= (srcLeft
.even
< srcRight
.even
) ^ imask11;
mask = pseudomask.xxyyzzww;
theArray[i] = (srcLeft & mask) | (srcRight & ~mask);
theArray[i] = (srcLeft & mask) | (srcRight & ~mask);
}
}
else
else
{
{
srcLeft = (srcLeft & ~mask) | (srcRight & mask);
srcLeft = (srcLeft & ~mask) | (srcRight & mask);
Copier
Copié
Copier
Copié
srcRight = srcLeft.
yxwz
;
mask
= (srcLeft
< srcRight
) ^ imask11;
srcRight = srcLeft.
s23016745
;
pseudomask
= (srcLeft
.even
< srcRight
.even
) ^ imask11;
mask = pseudomask.xxyyzzww;
theArray[i] = (srcLeft & ~mask) | (srcRight & mask);
theArray[i] = (srcLeft & ~mask) | (srcRight & mask);
}
}
}
}
}
}
Différences enregistrées
Texte d'origine
Ouvrir un fichier
// Copyright (c) 2009-2011 Intel Corporation // All rights reserved. // // WARRANTY DISCLAIMER // // THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE // MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Intel Corporation is the author of the Materials, and requests that all // problem reports or change requests be submitted to it directly __kernel void /*__attribute__((vec_type_hint(int4)))*/ BitonicSort(__global int4 * theArray, const uint stage, const uint passOfStage, const uint dir) { size_t i = get_global_id(0); int4 srcLeft, srcRight, mask; int4 imask10 = (int4)(0, 0, -1, -1); int4 imask11 = (int4)(0, -1, 0, -1); if(stage > 0) { if(passOfStage > 0) // upper level pass, exchange between two fours, operating on half size { size_t r = 1 << (passOfStage - 1); size_t lmask = r - 1; size_t left = ((i>>(passOfStage-1)) << passOfStage) + (i & lmask); size_t right = left + r; srcLeft = theArray[left]; srcRight = theArray[right]; mask = srcLeft < srcRight; int4 imin = (srcLeft & mask) | (srcRight & ~mask); int4 imax = (srcLeft & ~mask) | (srcRight & mask); if( ((i>>(stage-1)) & 1) ^ dir ) { theArray[left] = imin; theArray[right] = imax; } else { theArray[right] = imin; theArray[left] = imax; } } else // last pass, sort inside one four, operating on full size { srcLeft = theArray[i]; srcRight = srcLeft.zwxy; mask = (srcLeft < srcRight) ^ imask10; if(((i >> stage) & 1) ^ dir) { srcLeft = (srcLeft & mask) | (srcRight & ~mask); srcRight = srcLeft.yxwz; mask = (srcLeft < srcRight) ^ imask11; theArray[i] = (srcLeft & mask) | (srcRight & ~mask); } else { srcLeft = (srcLeft & ~mask) | (srcRight & mask); srcRight = srcLeft.yxwz; mask = (srcLeft < srcRight) ^ imask11; theArray[i] = (srcLeft & ~mask) | (srcRight & mask); } } } else // first stage, sort inside one four { int4 imask0 = (int4)(0, -1, -1, 0); srcLeft = theArray[i]; srcRight = srcLeft.yxwz; mask = (srcLeft < srcRight) ^ imask0; if( dir ) srcLeft = (srcLeft & mask) | (srcRight & ~mask); else srcLeft = (srcLeft & ~mask) | (srcRight & mask); srcRight = srcLeft.zwxy; mask = (srcLeft < srcRight) ^ imask10; if((i & 1) ^ dir) { srcLeft = (srcLeft & mask) | (srcRight & ~mask); srcRight = srcLeft.yxwz; mask = (srcLeft < srcRight) ^ imask11; theArray[i] = (srcLeft & mask) | (srcRight & ~mask); } else { srcLeft = (srcLeft & ~mask) | (srcRight & mask); srcRight = srcLeft.yxwz; mask = (srcLeft < srcRight) ^ imask11; theArray[i] = (srcLeft & ~mask) | (srcRight & mask); } } }
Texte modifié
Ouvrir un fichier
// Copyright (c) 2009-2011 Intel Corporation // All rights reserved. // // WARRANTY DISCLAIMER // // THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE // MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Intel Corporation is the author of the Materials, and requests that all // problem reports or change requests be submitted to it directly // https://software.intel.com/en-us/articles/bitonic-sorting // Modified to sort int2 key-value array __kernel void BitonicSort(__global int8* theArray, const uint stage, const uint passOfStage, const uint dir) { size_t i = get_global_id(0); int8 srcLeft, srcRight, mask; int4 pseudomask; int4 imask10 = (int4)(0, 0, -1, -1); int4 imask11 = (int4)(0, -1, 0, -1); if(stage > 0) { if(passOfStage > 0) // upper level pass, exchange between two fours, { size_t r = 1 << (passOfStage - 1); size_t lmask = r - 1; size_t left = ((i>>(passOfStage-1)) << passOfStage) + (i & lmask); size_t right = left + r; srcLeft = theArray[left]; srcRight = theArray[right]; pseudomask = srcLeft.even < srcRight.even; mask = pseudomask.xxyyzzww; int8 imin = (srcLeft & mask) | (srcRight & ~mask); int8 imax = (srcLeft & ~mask) | (srcRight & mask); if( ((i>>(stage-1)) & 1) ^ dir ) { theArray[left] = imin; theArray[right] = imax; } else { theArray[right] = imin; theArray[left] = imax; } } else // last pass, sort inside one four { srcLeft = theArray[i]; srcRight = srcLeft.s45670123; pseudomask = (srcLeft.even < srcRight.even) ^ imask10; mask = pseudomask.xxyyzzww; if(((i >> stage) & 1) ^ dir) { srcLeft = (srcLeft & mask) | (srcRight & ~mask); srcRight = srcLeft.s23016745; pseudomask = (srcLeft.even < srcRight.even) ^ imask11; mask = pseudomask.xxyyzzww; theArray[i] = (srcLeft & mask) | (srcRight & ~mask); } else { srcLeft = (srcLeft & ~mask) | (srcRight & mask); srcRight = srcLeft.s23016745; pseudomask = (srcLeft.even < srcRight.even) ^ imask11; mask = pseudomask.xxyyzzww; theArray[i] = (srcLeft & ~mask) | (srcRight & mask); } } } else // first stage, sort inside one four { int4 imask0 = (int4)(0, -1, -1, 0); srcLeft = theArray[i]; srcRight = srcLeft.s23016745; pseudomask = (srcLeft.even < srcRight.even) ^ imask0; mask = pseudomask.xxyyzzww; if( dir ) srcLeft = (srcLeft & mask) | (srcRight & ~mask); else srcLeft = (srcLeft & ~mask) | (srcRight & mask); srcRight = srcLeft.s45670123; pseudomask = (srcLeft.even < srcRight.even) ^ imask10; mask = pseudomask.xxyyzzww; if((i & 1) ^ dir) { srcLeft = (srcLeft & mask) | (srcRight & ~mask); srcRight = srcLeft.s23016745; pseudomask = (srcLeft.even < srcRight.even) ^ imask11; mask = pseudomask.xxyyzzww; theArray[i] = (srcLeft & mask) | (srcRight & ~mask); } else { srcLeft = (srcLeft & ~mask) | (srcRight & mask); srcRight = srcLeft.s23016745; pseudomask = (srcLeft.even < srcRight.even) ^ imask11; mask = pseudomask.xxyyzzww; theArray[i] = (srcLeft & ~mask) | (srcRight & mask); } } }
Trouver la différence