< prev index next >

test/jdk/jdk/incubator/vector/templates/Perf-header.template

Print this page
rev 54658 : refactored mask and shuffle creation methods, moved classes to top-level


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have
  21  * questions.
  22  */
  23 
  24 package benchmark.jdk.incubator.vector;
  25 
  26 import jdk.incubator.vector.Vector;
  27 import jdk.incubator.vector.Vector.Shape;
  28 import jdk.incubator.vector.Vector.Species;

  29 import jdk.incubator.vector.$Type$Vector;
  30 
  31 import java.util.concurrent.TimeUnit;
  32 import java.util.function.BiFunction;
  33 import java.util.function.IntFunction;
  34 
  35 import org.openjdk.jmh.annotations.*;
  36 import org.openjdk.jmh.infra.Blackhole;
  37 
  38 @BenchmarkMode(Mode.Throughput)
  39 @OutputTimeUnit(TimeUnit.MILLISECONDS)
  40 @State(Scope.Benchmark)
  41 @Warmup(iterations = 3, time = 1)
  42 @Measurement(iterations = 5, time = 1)
  43 @Fork(value = 1, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"})
  44 public class $vectorbenchtype$ extends AbstractVectorBenchmark {
  45 #if[MaxBit]
  46     static final Species<$Wideboxtype$> SPECIES = $Type$Vector.SPECIES_MAX;
  47 #else[MaxBit]
  48     static final Species<$Wideboxtype$> SPECIES = $Type$Vector.SPECIES_$bits$;
  49 #end[MaxBit]
  50 
  51     static final int INVOC_COUNT = 1; // get rid of outer loop
  52 
  53     @Param("1024")
  54     int size;
  55 
  56     $type$[] fill(IntFunction<$Wideboxtype$> f) {
  57         $type$[] array = new $type$[size];
  58         for (int i = 0; i < array.length; i++) {
  59             array[i] = f.apply(i);
  60         }
  61         return array;
  62     }
  63 
  64     $type$[] a, b, c, r;
  65     boolean[] m, rm;
  66     int[] s;
  67 
  68     @Setup




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have
  21  * questions.
  22  */
  23 
  24 package benchmark.jdk.incubator.vector;
  25 
  26 import jdk.incubator.vector.Vector;
  27 import jdk.incubator.vector.VectorShape;
  28 import jdk.incubator.vector.VectorSpecies;
  29 import jdk.incubator.vector.VectorShuffle;
  30 import jdk.incubator.vector.$Type$Vector;
  31 
  32 import java.util.concurrent.TimeUnit;
  33 import java.util.function.BiFunction;
  34 import java.util.function.IntFunction;
  35 
  36 import org.openjdk.jmh.annotations.*;
  37 import org.openjdk.jmh.infra.Blackhole;
  38 
  39 @BenchmarkMode(Mode.Throughput)
  40 @OutputTimeUnit(TimeUnit.MILLISECONDS)
  41 @State(Scope.Benchmark)
  42 @Warmup(iterations = 3, time = 1)
  43 @Measurement(iterations = 5, time = 1)
  44 @Fork(value = 1, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"})
  45 public class $vectorbenchtype$ extends AbstractVectorBenchmark {
  46 #if[MaxBit]
  47     static final VectorSpecies<$Wideboxtype$> SPECIES = $Type$Vector.SPECIES_MAX;
  48 #else[MaxBit]
  49     static final VectorSpecies<$Wideboxtype$> SPECIES = $Type$Vector.SPECIES_$bits$;
  50 #end[MaxBit]
  51 
  52     static final int INVOC_COUNT = 1; // get rid of outer loop
  53 
  54     @Param("1024")
  55     int size;
  56 
  57     $type$[] fill(IntFunction<$Wideboxtype$> f) {
  58         $type$[] array = new $type$[size];
  59         for (int i = 0; i < array.length; i++) {
  60             array[i] = f.apply(i);
  61         }
  62         return array;
  63     }
  64 
  65     $type$[] a, b, c, r;
  66     boolean[] m, rm;
  67     int[] s;
  68 
  69     @Setup


< prev index next >