annotate graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java @ 13200:ebdc13d9845d

replaced use of graal.compileTheWorldTest.log system property with a field to control CTW verbosity which is true by default but is set to false by CTW unit test
author Doug Simon <doug.simon@oracle.com>
date Sat, 30 Nov 2013 11:07:41 +0100
parents 06d9596a909e
children 1095dcf7f028
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7834
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents: 8959
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
7834
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.compiler.ptx.test;
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
13185
06d9596a909e refactored all PTX reporting to use PTXTestBase.printReport()
Doug Simon <doug.simon@oracle.com>
parents: 11923
diff changeset
25 import java.lang.reflect.*;
7834
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26
13185
06d9596a909e refactored all PTX reporting to use PTXTestBase.printReport()
Doug Simon <doug.simon@oracle.com>
parents: 11923
diff changeset
27 import org.junit.*;
7834
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 /**
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30 * Test class for small Java methods compiled to PTX kernels.
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31 */
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents: 8959
diff changeset
32 public class BasicPTXTest extends PTXTestBase {
7834
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 @Test
7928
47a7e8d80536 Added new basic array PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7841
diff changeset
35 public void testAdd() {
10879
d55f24eac4b1 PTX support for Linux
Morris Meyer <morris.meyer@oracle.com>
parents: 10583
diff changeset
36 invoke(compile("testConstI"));
7834
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37 }
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38
10879
d55f24eac4b1 PTX support for Linux
Morris Meyer <morris.meyer@oracle.com>
parents: 10583
diff changeset
39 @Test
10577
9c7d9e2c8326 PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents: 9430
diff changeset
40 public void testInvoke() {
9c7d9e2c8326 PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents: 9430
diff changeset
41 invoke(compile("testConstI"));
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9007
diff changeset
42 }
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9007
diff changeset
43
11485
49bb1bc983c6 Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents: 10879
diff changeset
44 public static int testConstI() {
10577
9c7d9e2c8326 PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents: 9430
diff changeset
45 return 42;
7834
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 }
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47
8463
b2161263e9f2 Cleanup unit tests : they should not print to stdout/stderr
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8217
diff changeset
48 public static void main(String[] args) {
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents: 8959
diff changeset
49 BasicPTXTest test = new BasicPTXTest();
8605
1d12b11e80c0 made it easier to run newly added PTX test methods from the command line
Doug Simon <doug.simon@oracle.com>
parents: 8463
diff changeset
50 Method[] methods = BasicPTXTest.class.getMethods();
1d12b11e80c0 made it easier to run newly added PTX test methods from the command line
Doug Simon <doug.simon@oracle.com>
parents: 8463
diff changeset
51 for (Method m : methods) {
9007
bd2ace51ba04 GRAAL-221 - PTX array load and store support
Morris Meyer <morris.meyer@oracle.com>
parents: 8995
diff changeset
52 String name = m.getName();
bd2ace51ba04 GRAAL-221 - PTX array load and store support
Morris Meyer <morris.meyer@oracle.com>
parents: 8995
diff changeset
53 if (m.getAnnotation(Test.class) == null && name.startsWith("test")) {
13185
06d9596a909e refactored all PTX reporting to use PTXTestBase.printReport()
Doug Simon <doug.simon@oracle.com>
parents: 11923
diff changeset
54 printReport(name + ": \n" + new String(test.compile(name).getTargetCode()));
8605
1d12b11e80c0 made it easier to run newly added PTX test methods from the command line
Doug Simon <doug.simon@oracle.com>
parents: 8463
diff changeset
55 }
1d12b11e80c0 made it easier to run newly added PTX test methods from the command line
Doug Simon <doug.simon@oracle.com>
parents: 8463
diff changeset
56 }
8463
b2161263e9f2 Cleanup unit tests : they should not print to stdout/stderr
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8217
diff changeset
57 }
7834
13344e69455e Added basic PTX test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 }