Example #1
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   random.setSeed(10);
   script = new ScriptC_getset(mRS);
   scriptRelaxed = new ScriptC_getset_relaxed(mRS);
   script.set_gWidth(gWidth);
   script.set_gHeight(gHeight);
   scriptRelaxed.set_gWidth(gWidth);
   scriptRelaxed.set_gHeight(gHeight);
 }
Example #2
0
  public void testGetSet_double() {
    testSetup(Element.F64(mRS));
    double tmp[] = randomDoubleArray(gCount);
    double tmp2[] = new double[gCount];
    script.forEach_copy1D_double(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch double: ", 1);
    scriptRelaxed.forEach_copy1D_double(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch relaxed double: ", 1);

    script.forEach_copy2D_double(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch double: ", 1);
    scriptRelaxed.forEach_copy2D_double(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch relaxed double: ", 1);

    script.forEach_copy3D_double(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch double: ", 1);
    scriptRelaxed.forEach_copy3D_double(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch relaxed double: ", 1);
  }
Example #3
0
  public void testGetSet_float4() {
    testSetup(Element.F32_4(mRS));
    float tmp[] = randomFloatArray(gCount);
    float tmp2[] = new float[gCount];
    script.forEach_copy1D_float4(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch float4: ", 4);
    scriptRelaxed.forEach_copy1D_float4(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch relaxed float4: ", 4);

    script.forEach_copy2D_float4(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch float4: ", 4);
    scriptRelaxed.forEach_copy2D_float4(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch relaxed float4: ", 4);

    script.forEach_copy3D_float4(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch float4: ", 4);
    scriptRelaxed.forEach_copy3D_float4(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch relaxed float4: ", 4);
  }
Example #4
0
  public void testGetSet_ulong4() {
    testSetup(Element.U64_4(mRS));
    long tmp[] = randomLongArray(gCount);
    long tmp2[] = new long[gCount];
    script.forEach_copy1D_ulong4(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch ulong4: ", 4);
    scriptRelaxed.forEach_copy1D_ulong4(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch relaxed ulong4: ", 4);

    script.forEach_copy2D_ulong4(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch ulong4: ", 4);
    scriptRelaxed.forEach_copy2D_ulong4(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch relaxed ulong4: ", 4);

    script.forEach_copy3D_ulong4(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch ulong4: ", 4);
    scriptRelaxed.forEach_copy3D_ulong4(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch relaxed ulong4: ", 4);
  }
Example #5
0
  public void testGetSet_long3() {
    testSetup(Element.I64_3(mRS));
    long tmp[] = randomLongArray(gCount);
    long tmp2[] = new long[gCount];
    script.forEach_copy1D_long3(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch long3: ", 3);
    scriptRelaxed.forEach_copy1D_long3(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch relaxed long3: ", 3);

    script.forEach_copy2D_long3(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch long3: ", 3);
    scriptRelaxed.forEach_copy2D_long3(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch relaxed long3: ", 3);

    script.forEach_copy3D_long3(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch long3: ", 3);
    scriptRelaxed.forEach_copy3D_long3(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch relaxed long3: ", 3);
  }
Example #6
0
  public void testGetSet_uint4() {
    testSetup(Element.U32_4(mRS));
    int tmp[] = randomIntArray(gCount);
    int tmp2[] = new int[gCount];
    script.forEach_copy1D_uint4(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch uint4: ", 4);
    scriptRelaxed.forEach_copy1D_uint4(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch relaxed uint4: ", 4);

    script.forEach_copy2D_uint4(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch uint4: ", 4);
    scriptRelaxed.forEach_copy2D_uint4(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch relaxed uint4: ", 4);

    script.forEach_copy3D_uint4(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch uint4: ", 4);
    scriptRelaxed.forEach_copy3D_uint4(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch relaxed uint4: ", 4);
  }
Example #7
0
  public void testGetSet_int3() {
    testSetup(Element.I32_3(mRS));
    int tmp[] = randomIntArray(gCount);
    int tmp2[] = new int[gCount];
    script.forEach_copy1D_int3(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch int3: ", 3);
    scriptRelaxed.forEach_copy1D_int3(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch relaxed int3: ", 3);

    script.forEach_copy2D_int3(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch int3: ", 3);
    scriptRelaxed.forEach_copy2D_int3(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch relaxed int3: ", 3);

    script.forEach_copy3D_int3(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch int3: ", 3);
    scriptRelaxed.forEach_copy3D_int3(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch relaxed int3: ", 3);
  }
Example #8
0
  public void testGetSet_ushort3() {
    testSetup(Element.U16_3(mRS));
    short tmp[] = randomShortArray(gCount);
    short tmp2[] = new short[gCount];
    script.forEach_copy1D_ushort3(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch ushort3: ", 3);
    scriptRelaxed.forEach_copy1D_ushort3(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch relaxed ushort3: ", 3);

    script.forEach_copy2D_ushort3(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch ushort3: ", 3);
    scriptRelaxed.forEach_copy2D_ushort3(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch relaxed ushort3: ", 3);

    script.forEach_copy3D_ushort3(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch ushort3: ", 3);
    scriptRelaxed.forEach_copy3D_ushort3(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch relaxed ushort3: ", 3);
  }
Example #9
0
  public void testGetSet_short4() {
    testSetup(Element.I16_4(mRS));
    short tmp[] = randomShortArray(gCount);
    short tmp2[] = new short[gCount];
    script.forEach_copy1D_short4(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch short4: ", 4);
    scriptRelaxed.forEach_copy1D_short4(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch relaxed short4: ", 4);

    script.forEach_copy2D_short4(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch short4: ", 4);
    scriptRelaxed.forEach_copy2D_short4(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch relaxed short4: ", 4);

    script.forEach_copy3D_short4(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch short4: ", 4);
    scriptRelaxed.forEach_copy3D_short4(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch relaxed short4: ", 4);
  }
Example #10
0
  public void testGetSet_uchar4() {
    testSetup(Element.U8_4(mRS));
    byte tmp[] = randomByteArray(gCount);
    byte tmp2[] = new byte[gCount];
    script.forEach_copy1D_uchar4(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch uchar4: ", 4);
    scriptRelaxed.forEach_copy1D_uchar4(walkAlloc);
    verify(tmp, tmp2, out1DAlloc, "Data mismatch relaxed uchar4: ", 4);

    script.forEach_copy2D_uchar4(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch uchar4: ", 4);
    scriptRelaxed.forEach_copy2D_uchar4(walkAlloc);
    verify(tmp, tmp2, out2DAlloc, "Data mismatch relaxed uchar4: ", 4);

    script.forEach_copy3D_uchar4(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch uchar4: ", 4);
    scriptRelaxed.forEach_copy3D_uchar4(walkAlloc);
    verify(tmp, tmp2, out3DAlloc, "Data mismatch relaxed uchar4: ", 4);
  }
Example #11
0
  private void testSetup(Element e) {
    int vs = e.getVectorSize();
    if (vs == 3) {
      vs = 4;
    }
    createWalk(vs);

    Type t1 = Type.createX(mRS, e, gWidth * gHeight * gDepth / vs);
    in1DAlloc = Allocation.createTyped(mRS, t1);
    out1DAlloc = Allocation.createTyped(mRS, t1);
    script.set_gAlloc1DIn(in1DAlloc);
    script.set_gAlloc1DOut(out1DAlloc);
    scriptRelaxed.set_gAlloc1DIn(in1DAlloc);
    scriptRelaxed.set_gAlloc1DOut(out1DAlloc);

    Type t2 = Type.createXY(mRS, e, gWidth / vs, gHeight * gDepth);
    in2DAlloc = Allocation.createTyped(mRS, t2);
    out2DAlloc = Allocation.createTyped(mRS, t2);
    script.set_gAlloc2DIn(in2DAlloc);
    script.set_gAlloc2DOut(out2DAlloc);
    scriptRelaxed.set_gAlloc2DIn(in2DAlloc);
    scriptRelaxed.set_gAlloc2DOut(out2DAlloc);

    Type t3 = Type.createXYZ(mRS, e, gWidth / vs, gHeight, gDepth);
    in3DAlloc = Allocation.createTyped(mRS, t3);
    out3DAlloc = Allocation.createTyped(mRS, t3);
    script.set_gAlloc3DIn(in3DAlloc);
    script.set_gAlloc3DOut(out3DAlloc);
    scriptRelaxed.set_gAlloc3DIn(in3DAlloc);
    scriptRelaxed.set_gAlloc3DOut(out3DAlloc);
  }