Mercurial > hg > truffle
annotate graal/com.oracle.graal.ptx/src/com/oracle/graal/ptx/PTX.java @ 18752:1acaa69ff61b
Truffle-DSL: refactor generator classes
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 29 Dec 2014 23:38:16 +0100 |
parents | edb88f5425e6 |
children |
rev | line source |
---|---|
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.ptx; |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 import static com.oracle.graal.api.code.MemoryBarriers.*; |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import java.nio.*; |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.api.code.*; |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
30 import com.oracle.graal.api.code.Register.RegisterCategory; |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
31 import com.oracle.graal.api.meta.*; |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 /** |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 * Represents the PTX architecture. |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 */ |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 public class PTX extends Architecture { |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 |
12503
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
11699
diff
changeset
|
38 public static final RegisterCategory REG = new RegisterCategory("REG"); |
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
11699
diff
changeset
|
39 public static final RegisterCategory SREG = new RegisterCategory("SREG"); |
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
11699
diff
changeset
|
40 public static final RegisterCategory PARAM = new RegisterCategory("PARAM"); |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
41 |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 // @formatter:off |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 /* |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 * Register State Space |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 * |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
47 * Registers (.reg state space) are fast storage locations. The |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
48 * number of GPU architectural registers is limited, and will vary |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
49 * from platform to platform. When the limit is exceeded, register |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
50 * variables will be spilled to memory, causing changes in |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
51 * performance. For each architecture, there is a recommended |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
52 * maximum number of registers to use (see the "CUDA Programming |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
53 * Guide" for details). |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
54 * |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
55 * TODD: XXX |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
56 * |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
57 * However, PTX supports virtual registers. So, the generated PTX |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
58 * code does not need to use a specified number of registers. Till |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
59 * we figure out how to model a virtual register set in Graal, we |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
60 * will pretend that we can use only 16 registers. |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 */ |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 |
11699
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
63 public static final Register r0 = new Register(0, 0, "r0", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
64 public static final Register r1 = new Register(1, 1, "r1", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
65 public static final Register r2 = new Register(2, 2, "r2", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
66 public static final Register r3 = new Register(3, 3, "r3", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
67 public static final Register r4 = new Register(4, 4, "r4", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
68 public static final Register r5 = new Register(5, 5, "r5", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
69 public static final Register r6 = new Register(6, 6, "r6", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
70 public static final Register r7 = new Register(7, 7, "r7", REG); |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 |
11699
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
72 public static final Register r8 = new Register(8, 8, "r8", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
73 public static final Register r9 = new Register(9, 9, "r9", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
74 public static final Register r10 = new Register(10, 10, "r10", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
75 public static final Register r11 = new Register(11, 11, "r11", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
76 public static final Register r12 = new Register(12, 12, "r12", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
77 public static final Register r13 = new Register(13, 13, "r13", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
78 public static final Register r14 = new Register(14, 14, "r14", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
79 public static final Register r15 = new Register(15, 15, "r15", REG); |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 public static final Register[] gprRegisters = { |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 r0, r1, r2, r3, r4, r5, r6, r7, |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 r8, r9, r10, r11, r12, r13, r14, r15 |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 }; |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 |
11699
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
86 /* Parameter State Space |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
87 * |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
88 * The parameter (.param) state space is used (1) to pass input |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
89 * arguments from the host to the kernel, (2a) to declare formal |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
90 * input and return parameters for device functions called from |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
91 * within kernel execution, and (2b) to declare locally-scoped |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
92 * byte array variables that serve as function call arguments, |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
93 * typically for passing large structures by value to a function. |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
94 * |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
95 * TODO: XXX |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
96 * The parameters are virtual symbols - just like registers. Bit, |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
97 * Till we figure out how to model a virtual register set in Graal, |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
98 * we will pretend that we can use only 8 parameters. |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
99 */ |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
100 |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
101 public static final Register param0 = new Register(16, 16, "param0", PARAM); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
102 public static final Register param1 = new Register(17, 17, "param1", PARAM); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
103 public static final Register param2 = new Register(18, 18, "param2", PARAM); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
104 public static final Register param3 = new Register(19, 19, "param3", PARAM); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
105 public static final Register param4 = new Register(20, 20, "param4", PARAM); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
106 public static final Register param5 = new Register(21, 21, "param5", PARAM); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
107 public static final Register param6 = new Register(22, 22, "param6", PARAM); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
108 public static final Register param7 = new Register(23, 23, "param7", PARAM); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
109 |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
110 public static final Register[] paramRegisters = { |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
111 param0, param1, param2, param3, param4, param5, param6, param7 |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
112 }; |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
113 |
11699
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
114 // Define a virtual register that holds return value |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
115 public static final Register retReg = new Register(24, 24, "retReg", REG); |
03fe11f5f186
PTX Codegen: predicate register materialization and declaration; conditional branch generation; fix register declaration.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
11596
diff
changeset
|
116 |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
117 // PTX ISA Manual: Section 9:. Special Registers |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
119 // PTX includes a number of predefined, read-only variables, which |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
120 // are visible as special registers and accessed through mov or |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
121 // cvt instructions. |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
122 // Thread identifier within a Co-operative Thread Array (CTA) - %tid |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
123 public static final Register tid = new Register(100, 100, "tid", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
124 // Number of thread IDs per CTA - %ntid |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
125 public static final Register ntid = new Register(101, 101, "ntid", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
126 // Lane identifier |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
127 public static final Register laneid = new Register(102, 102, "laneid", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
128 // Warp identifier |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
129 public static final Register warpid = new Register(103, 103, "warid", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
130 // Number of warp IDs |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
131 public static final Register nwarpid = new Register(104, 104, "nwarpid", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
132 // CTA identifier |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
133 public static final Register ctaid = new Register(105, 105, "ctaid", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
134 // Number of CTA IDs per grid |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
135 public static final Register nctaid = new Register(106, 106, "nctaid", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
136 // Single Multiprocessor (SM) ID |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
137 public static final Register smid = new Register(107, 107, "smid", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
138 // Number of SM IDs |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
139 public static final Register nsmid = new Register(108, 108, "nsmid", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
140 // Grid ID |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
141 public static final Register gridid = new Register(109, 109, "gridid", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
142 // 32-bit mask with bit set in position equal to thread's lane number in the warp |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
143 public static final Register lanemask_eq = new Register(110, 110, "lanemask_eq", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
144 // 32-bit mask with bits set in positions less than or equal to thread's lane number in the warp |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
145 public static final Register lanemask_le = new Register(111, 111, "lanemask_le", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
146 // 32-bit mask with bits set in positions less than thread's lane number in the warp |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
147 public static final Register lanemask_lt = new Register(112, 112, "lanemask_lt", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
148 // 32-bit mask with bits set in positions greater than or equal to thread's lane number in the warp |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
149 public static final Register lanemask_ge = new Register(113, 113, "lanemask_ge", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
150 // 32-bit mask with bits set in positions greater than thread's lane number in the warp |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
151 public static final Register lanemask_gt = new Register(114, 114, "lanemask_gt", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
152 // A predefined, read-only 32-bit unsigned 32-bit unsigned cycle counter |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
153 public static final Register clock = new Register(114, 114, "clock", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
154 // A predefined, read-only 64-bit unsigned 32-bit unsigned cycle counter |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
155 public static final Register clock64 = new Register(115, 115, "clock64", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
156 // Performance monitoring registers |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
157 public static final Register pm0 = new Register(116, 116, "pm0", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
158 public static final Register pm1 = new Register(117, 117, "pm1", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
159 public static final Register pm2 = new Register(118, 118, "pm2", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
160 public static final Register pm3 = new Register(119, 119, "pm3", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
161 public static final Register pm4 = new Register(120, 120, "pm4", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
162 public static final Register pm5 = new Register(121, 121, "pm5", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
163 public static final Register pm6 = new Register(122, 122, "pm6", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
164 public static final Register pm7 = new Register(123, 123, "pm7", SREG); |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
165 // TODO: Add Driver-defined read-only %envreg<32> |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
166 // and %globaltimer, %globaltimer_lo and %globaltimer_hi |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
167 |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
168 public static final Register[] specialRegisters = { |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
169 tid, ntid, laneid, warpid, nwarpid, ctaid, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
170 nctaid, smid, nsmid, gridid, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
171 lanemask_eq, lanemask_le, lanemask_lt, lanemask_ge, lanemask_gt, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
172 clock, clock64, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
173 pm0, pm1, pm2, pm3, pm4, pm5, pm6, pm7 |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
174 }; |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
175 |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 public static final Register[] allRegisters = { |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
177 // Parameter State Space |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
178 param0, param1, param2, param3, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
179 param4, param5, param6, param7, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
180 // Register State Space |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
181 r0, r1, r2, r3, r4, r5, r6, r7, |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
182 r8, r9, r10, r11, r12, r13, r14, r15, |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
183 // return register |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
184 retReg, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
185 // Special Register State Space - SREG |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
186 tid, ntid, laneid, warpid, nwarpid, ctaid, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
187 nctaid, smid, nsmid, gridid, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
188 lanemask_eq, lanemask_le, lanemask_lt, lanemask_ge, lanemask_gt, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
189 clock, clock64, |
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
190 pm0, pm1, pm2, pm3, pm4, pm5, pm6, pm7 |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
191 }; |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
192 |
10898 | 193 // @formatter:on |
194 | |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
195 public PTX() { |
12503
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
11699
diff
changeset
|
196 super("PTX", 8, ByteOrder.LITTLE_ENDIAN, false, allRegisters, LOAD_STORE | STORE_STORE, 0, r15.encoding + 1, 8); |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
197 } |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
198 |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
199 @Override |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
200 public boolean canStoreValue(RegisterCategory category, PlatformKind lirKind) { |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
201 if (!(lirKind instanceof Kind)) { |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
202 return false; |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
203 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
204 |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
205 Kind kind = (Kind) lirKind; |
18253
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16094
diff
changeset
|
206 if (category.equals(REG)) { |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
207 switch (kind) { |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
208 case Boolean: |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
209 case Byte: |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
210 case Char: |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
211 case Short: |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
212 case Int: |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
213 case Long: |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
214 case Object: |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
215 case Float: |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
216 case Double: |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
217 return true; |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
218 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
219 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
220 |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
221 return false; |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
222 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
223 |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
224 @Override |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
225 public PlatformKind getLargestStorableKind(RegisterCategory category) { |
18253
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16094
diff
changeset
|
226 if (category.equals(REG)) { |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
227 return Kind.Double; |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
228 } else { |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
229 return Kind.Illegal; |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
230 } |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
7804
diff
changeset
|
231 } |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
10898
diff
changeset
|
232 |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 } |