Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/ForEachToGraal.java @ 15021:9dcd5407a603
added support for overriding/complementing JMH arguments in jmh command with a JSON string
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 08 Apr 2014 16:04:59 +0200 |
parents | 64dcb92ee75a |
children | 288c23143d47 |
rev | line source |
---|---|
10662
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
24 package com.oracle.graal.hotspot.hsail; |
10662
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
26 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
27 |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
28 import java.lang.reflect.*; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
29 |
12045
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
10662
diff
changeset
|
30 import com.oracle.graal.api.code.*; |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
31 import com.oracle.graal.api.meta.*; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
32 import com.oracle.graal.compiler.hsail.*; |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
33 import com.oracle.graal.compiler.target.*; |
12045
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
10662
diff
changeset
|
34 import com.oracle.graal.debug.*; |
13976
272995b3c019
HSAIL: ensure debug configuration is initialized on Sumatra threads using Graal
Doug Simon <doug.simon@oracle.com>
parents:
13903
diff
changeset
|
35 import com.oracle.graal.debug.internal.*; |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14768
diff
changeset
|
36 import com.oracle.graal.gpu.*; |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
37 import com.oracle.graal.graph.iterators.*; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
38 import com.oracle.graal.hotspot.meta.*; |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
39 import com.oracle.graal.hsail.*; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
40 import com.oracle.graal.java.*; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
41 import com.oracle.graal.nodes.*; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
42 import com.oracle.graal.nodes.java.*; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
43 import com.oracle.graal.phases.*; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
44 import com.oracle.graal.phases.util.*; |
13976
272995b3c019
HSAIL: ensure debug configuration is initialized on Sumatra threads using Graal
Doug Simon <doug.simon@oracle.com>
parents:
13903
diff
changeset
|
45 import com.oracle.graal.printer.*; |
10662
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 /** |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 * Implements compile and dispatch of Java code containing lambda constructs. Currently only used by |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 * JDK interception code that offloads to the GPU. |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 */ |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 public class ForEachToGraal implements CompileAndDispatch { |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
53 private static HSAILHotSpotBackend getHSAILBackend() { |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
54 Backend backend = runtime().getBackend(HSAIL.class); |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
55 return (HSAILHotSpotBackend) backend; |
10662
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
58 /** |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
59 * Gets a compiled and installed kernel for the lambda called by the {@code accept(int value)} |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
60 * method in a class implementing {@code java.util.function.IntConsumer}. |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
61 * |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
62 * @param intConsumerClass a class implementing {@code java.util.function.IntConsumer} |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
63 * @return a {@link HotSpotNmethod} handle to the compiled and installed kernel |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
64 */ |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
65 private static HotSpotNmethod getCompiledLambda(Class intConsumerClass) { |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
66 Method acceptMethod = null; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
67 for (Method m : intConsumerClass.getMethods()) { |
13903
a08b2fe89f47
HSAIL: fixed regression causing object lambda demos to break
Doug Simon <doug.simon@oracle.com>
parents:
13819
diff
changeset
|
68 if (m.getName().equals("accept")) { |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
69 assert acceptMethod == null : "found more than one implementation of accept(int) in " + intConsumerClass; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
70 acceptMethod = m; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
71 } |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
72 } |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
73 |
13976
272995b3c019
HSAIL: ensure debug configuration is initialized on Sumatra threads using Graal
Doug Simon <doug.simon@oracle.com>
parents:
13903
diff
changeset
|
74 // Ensure a debug configuration for this thread is initialized |
272995b3c019
HSAIL: ensure debug configuration is initialized on Sumatra threads using Graal
Doug Simon <doug.simon@oracle.com>
parents:
13903
diff
changeset
|
75 if (DebugScope.getConfig() == null) { |
272995b3c019
HSAIL: ensure debug configuration is initialized on Sumatra threads using Graal
Doug Simon <doug.simon@oracle.com>
parents:
13903
diff
changeset
|
76 DebugEnvironment.initialize(System.out); |
272995b3c019
HSAIL: ensure debug configuration is initialized on Sumatra threads using Graal
Doug Simon <doug.simon@oracle.com>
parents:
13903
diff
changeset
|
77 } |
272995b3c019
HSAIL: ensure debug configuration is initialized on Sumatra threads using Graal
Doug Simon <doug.simon@oracle.com>
parents:
13903
diff
changeset
|
78 |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
79 HSAILHotSpotBackend backend = getHSAILBackend(); |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
80 Providers providers = backend.getProviders(); |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
81 StructuredGraph graph = new StructuredGraph(((HotSpotMetaAccessProvider) providers.getMetaAccess()).lookupJavaMethod(acceptMethod)); |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
82 new GraphBuilderPhase.Instance(providers.getMetaAccess(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL).apply(graph); |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
83 NodeIterable<MethodCallTargetNode> calls = graph.getNodes(MethodCallTargetNode.class); |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
84 assert calls.count() == 1; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
85 ResolvedJavaMethod lambdaMethod = calls.first().targetMethod(); |
14636
733e50d96f9b
fixed usages of Debug.log()
Doug Simon <doug.simon@oracle.com>
parents:
14157
diff
changeset
|
86 Debug.log("target ... %s", lambdaMethod); |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
87 |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
88 if (lambdaMethod == null) { |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
89 Debug.log("Did not find call in accept()"); |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
90 return null; |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
91 } |
14157 | 92 assert lambdaMethod.getName().startsWith("lambda$"); |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
93 |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
94 ExternalCompilationResult hsailCode = backend.compileKernel(lambdaMethod, true); |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
95 return backend.installKernel(lambdaMethod, hsailCode); |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
96 } |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
97 |
10662
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 @Override |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
99 public Object createKernel(Class<?> consumerClass) { |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 try { |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
101 return getCompiledLambda(consumerClass); |
10662
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
102 } catch (Throwable e) { |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
103 // If Graal compilation throws an exception, we want to revert to regular Java |
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
104 Debug.log("WARNING: Graal compilation failed"); |
10662
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 e.printStackTrace(); |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
106 return null; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
110 @Override |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 public boolean dispatchKernel(Object kernel, int jobSize, Object[] args) { |
13784
219a84093dda
moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
112 HotSpotNmethod code = (HotSpotNmethod) kernel; |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
113 if (code != null) { |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
114 try { |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
115 // No return value from HSAIL kernels |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13784
diff
changeset
|
116 getHSAILBackend().executeKernel(code, jobSize, args); |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
117 return true; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
118 } catch (InvalidInstalledCodeException iice) { |
14636
733e50d96f9b
fixed usages of Debug.log()
Doug Simon <doug.simon@oracle.com>
parents:
14157
diff
changeset
|
119 Debug.log("WARNING: Invalid installed code at exec time: %s", iice); |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
120 iice.printStackTrace(); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
121 return false; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
122 } |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
123 } else { |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12474
diff
changeset
|
124 // Should throw something sensible here |
10662
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 return false; |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 } |
4ef92b67aeae
added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 } |