annotate graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/ForEachToGraal.java @ 18163:c88ab4f1f04a

re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
author Doug Simon <doug.simon@oracle.com>
date Fri, 24 Oct 2014 16:18:10 +0200
parents cbd42807a31f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.*;
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
29 import java.util.*;
16841
cbd42807a31f moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents: 16119
diff changeset
30 import java.util.concurrent.*;
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
31 import java.util.function.*;
13784
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
32
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
33 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
34 import com.oracle.graal.api.meta.*;
16841
cbd42807a31f moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents: 16119
diff changeset
35 import com.oracle.graal.compiler.common.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
36 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
37 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
38 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
39 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
40 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
41 import com.oracle.graal.graph.iterators.*;
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
42 import com.oracle.graal.hotspot.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
43 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
44 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
45 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
46 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
47 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
48 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
49 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
50 import com.oracle.graal.printer.*;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
52 /**
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
53 * 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
54 * JDK interception code that offloads to the GPU.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
55 */
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
56 public class ForEachToGraal implements CompileAndDispatch {
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 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
59 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
60 return (HSAILHotSpotBackend) backend;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
61 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
62
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
63 ConcurrentHashMap<Class<?>, String> resolvedConsumerTargetMethods = new ConcurrentHashMap<>();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
64
13784
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
65 /**
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
66 * Returns the name of the reduction method given a class implementing {@link IntConsumer}.
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
67 *
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
68 * @param opClass a class implementing {@link IntConsumer}.
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
69 * @return the name of the reduction method
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
70 */
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
71 public String getIntReduceTargetName(Class<?> opClass) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
72 String cachedMethodName = resolvedConsumerTargetMethods.get(Objects.requireNonNull(opClass));
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
73 if (cachedMethodName != null) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
74 return cachedMethodName;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
75 } else {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
76 Method acceptMethod = null;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
77 for (Method m : opClass.getMethods()) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
78 if (m.getName().equals("applyAsInt")) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
79 assert acceptMethod == null : "found more than one implementation of applyAsInt in " + opClass;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
80 acceptMethod = m;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
81 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
82 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
83 // Ensure a debug configuration for this thread is initialized
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
84 if (DebugScope.getConfig() == null) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
85 DebugEnvironment.initialize(System.out);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
86 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
87
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
88 HSAILHotSpotBackend backend = getHSAILBackend();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
89 Providers providers = backend.getProviders();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
90 StructuredGraph graph = new StructuredGraph(((HotSpotMetaAccessProvider) providers.getMetaAccess()).lookupJavaMethod(acceptMethod));
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
91 new GraphBuilderPhase.Instance(providers.getMetaAccess(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL).apply(graph);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
92 NodeIterable<MethodCallTargetNode> calls = graph.getNodes(MethodCallTargetNode.class);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
93 assert calls.count() == 1;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
94 ResolvedJavaMethod lambdaMethod = calls.first().targetMethod();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
95 Debug.log("target ... %s", lambdaMethod);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
96
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
97 String className = lambdaMethod.getDeclaringClass().getName();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
98 if (!className.equals("Ljava/lang/Integer;")) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
99 return null;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
100 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
101 resolvedConsumerTargetMethods.put(opClass, lambdaMethod.getName());
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
102 return lambdaMethod.getName().intern();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
103 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
104 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
105
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
106 /**
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
107 * Gets a compiled and installed kernel for the lambda called by the
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
108 * {@link IntConsumer#accept(int)} method in a class implementing {@link IntConsumer}.
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
109 *
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
110 * @param intConsumerClass a class implementing {@link IntConsumer}
13784
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
111 * @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
112 */
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 14991
diff changeset
113 private static HotSpotNmethod getCompiledLambda(Class<?> intConsumerClass) {
13784
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
114 Method acceptMethod = null;
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
115 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
116 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
117 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
118 acceptMethod = m;
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
119 }
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
120 }
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
121
13976
272995b3c019 HSAIL: ensure debug configuration is initialized on Sumatra threads using Graal
Doug Simon <doug.simon@oracle.com>
parents: 13903
diff changeset
122 // 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
123 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
124 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
125 }
272995b3c019 HSAIL: ensure debug configuration is initialized on Sumatra threads using Graal
Doug Simon <doug.simon@oracle.com>
parents: 13903
diff changeset
126
13784
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
127 HSAILHotSpotBackend backend = getHSAILBackend();
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
128 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
129 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
130 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
131 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
132 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
133 ResolvedJavaMethod lambdaMethod = calls.first().targetMethod();
14636
733e50d96f9b fixed usages of Debug.log()
Doug Simon <doug.simon@oracle.com>
parents: 14157
diff changeset
134 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
135
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
136 if (lambdaMethod == null) {
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
137 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
138 return null;
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
139 }
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13976
diff changeset
140 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
141
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
142 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
143 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
144 }
219a84093dda moved HSAIL compilation harness logic into HSAILHotSpotBackend and deleted HSAILCompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 12743
diff changeset
145
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146 @Override
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
147 public Object createKernel(Class<?> consumerClass) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
148 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
149 return getCompiledLambda(consumerClass);
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
150 } 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
151 // 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
152 Debug.log("WARNING: Graal compilation failed");
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
153 e.printStackTrace();
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
154 return null;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
155 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
156 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
157
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
158 @Override
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
159 public Object createKernelFromHsailString(String code, String methodName) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
160 ExternalCompilationResult hsailCode = new ExternalCompilationResult();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
161 try (Debug.Scope ds = Debug.scope("GeneratingKernelBinary")) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
162
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
163 HSAILHotSpotBackend backend = getHSAILBackend();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
164 Providers providers = backend.getProviders();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
165 Method integerOffloadMethod = null;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
166
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
167 for (Method m : Integer.class.getMethods()) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
168 if (m.getName().equals(methodName)) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
169 integerOffloadMethod = m;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
170 break;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
171 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
172 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
173 if (integerOffloadMethod != null) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
174 ResolvedJavaMethod rm = ((HotSpotMetaAccessProvider) providers.getMetaAccess()).lookupJavaMethod(integerOffloadMethod);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
175
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
176 long kernel = HSAILHotSpotBackend.generateKernel(code.getBytes(), "Integer::" + methodName);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
177 if (kernel == 0) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
178 throw new GraalInternalError("Failed to compile HSAIL kernel from String");
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
179 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
180 hsailCode.setEntryPoint(kernel);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
181 return backend.installKernel(rm, hsailCode); // is a HotSpotNmethod
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
182 } else {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
183 return null;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
184 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
185 } catch (Throwable e) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
186 throw Debug.handle(e);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
187 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
188 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
189
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
190 @Override
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
191 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
192 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
193 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
194 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
195 // 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
196 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
197 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
198 } catch (InvalidInstalledCodeException iice) {
14636
733e50d96f9b fixed usages of Debug.log()
Doug Simon <doug.simon@oracle.com>
parents: 14157
diff changeset
199 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
200 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
201 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
202 }
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
203 } 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
204 // Should throw something sensible here
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
205 return false;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
206 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
207 }
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
208
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
209 /**
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
210 * Running with a larger global size seems to increase the performance for sum, but it might be
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
211 * different for other reductions so it is a knob.
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
212 */
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
213 private static final int GlobalSize = 1024 * Integer.getInteger("com.amd.sumatra.reduce.globalsize.multiple", 1);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
214
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
215 @Override
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
216 public Integer offloadIntReduceImpl(Object okraKernel, int identity, int[] streamSource) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
217 // NOTE - this reduce requires local size of 64 which is the SumatraUtils default
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
218
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
219 // Handmade reduce does not support +UseCompressedOops
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
220 HotSpotVMConfig config = runtime().getConfig();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
221 if (config.useCompressedOops == true || config.useHSAILDeoptimization == true) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
222 throw new GraalInternalError("Reduce offload not compatible with +UseCompressedOops or +UseHSAILDeoptimization");
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
223 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
224
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
225 try {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
226 assert streamSource.length >= GlobalSize : "Input array length=" + streamSource.length + " smaller than requested global_size=" + GlobalSize;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
227
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
228 int[] result = {identity};
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
229 Object[] args = {streamSource, result, streamSource.length};
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
230 args[0] = streamSource;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
231
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
232 dispatchKernel(okraKernel, GlobalSize, args);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
233
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
234 // kernel result is result[0].
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
235 return result[0];
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
236 } catch (Exception e) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
237 System.err.println(e);
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
238 e.printStackTrace();
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
239 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
240 return null;
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
241 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
242
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
243 @Override
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
244 public String getIntegerReduceIntrinsic(String reducerName) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
245
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
246 // Note all of these depend on group size of 256
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
247
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
248 String reduceOp = "/* Invalid */ ";
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
249 String atomicResultProduction = "/* Invalid */ ";
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
250 if (reducerName.equals("sum")) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
251 reduceOp = "add_u32 ";
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
252 atomicResultProduction = "atomicnoret_add_global_u32 ";
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
253 } else if (reducerName.equals("max")) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
254 reduceOp = "max_s32 ";
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
255 atomicResultProduction = "atomicnoret_max_global_s32 ";
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
256 } else if (reducerName.equals("min")) {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
257 reduceOp = "min_s32 ";
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
258 atomicResultProduction = "atomicnoret_min_global_s32 ";
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
259 } else {
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
260 return "/* Invalid */ ";
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
261 }
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
262
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
263 // @formatter:off
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
264 return new String(
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
265 "version 0:95:$full:$large; // BRIG Object Format Version 0:4" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
266 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
267 + "kernel &run(" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
268 + " align 8 kernarg_u64 %arg_p3," + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
269 + " align 8 kernarg_u64 %arg_p4," + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
270 + " align 4 kernarg_u32 %arg_p5)" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
271 + "{" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
272 + "" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
273 + " align 4 group_u32 %reduce_cllocal_scratch[256];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
274 + "" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
275 + " workitemabsid_u32 $s2, 0;" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
276 + "" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
277 + " ld_kernarg_u32 $s1, [%arg_p5];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
278 + " ld_kernarg_u64 $d0, [%arg_p4];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
279 + " ld_kernarg_u64 $d1, [%arg_p3];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
280 + "" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
281 + " add_u64 $d0, $d0, 24; // adjust over obj array headers" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
282 + " add_u64 $d1, $d1, 24;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
283 + " cmp_ge_b1_s32 $c0, $s2, $s1; // if(gloId < length){" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
284 + " cbr $c0, @BB0_1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
285 + " gridsize_u32 $s0, 0; // s0 is globalsize" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
286 + " add_u32 $s0, $s0, $s2; // gx += globalsize" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
287 + " cvt_s64_s32 $d2, $s2; // s2 is global id" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
288 + " shl_u64 $d2, $d2, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
289 + " add_u64 $d2, $d1, $d2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
290 + " ld_global_u32 $s3, [$d2]; // load this element from input" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
291 + " brn @BB0_3;" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
292 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
293 + "@BB0_1:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
294 + " mov_b32 $s0, $s2;" + "\n" + "" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
295 + "@BB0_3:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
296 + " cmp_ge_b1_s32 $c1, $s0, $s1; // while (gx < length)" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
297 + " cbr $c1, @BB0_6;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
298 + " gridsize_u32 $s2, 0;" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
299 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
300 + "@BB0_5:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
301 + " cvt_s64_s32 $d2, $s0;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
302 + " shl_u64 $d2, $d2, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
303 + " add_u64 $d2, $d1, $d2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
304 + " ld_global_u32 $s4, [$d2];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
305 + reduceOp + " $s3, $s3, $s4;" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
306 + " add_u32 $s0, $s0, $s2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
307 + " cmp_lt_b1_s32 $c1, $s0, $s1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
308 + " cbr $c1, @BB0_5;" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
309 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
310 + "@BB0_6:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
311 + " workgroupid_u32 $s0, 0;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
312 + " workgroupsize_u32 $s2, 0;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
313 + " mul_u32 $s2, $s2, $s0;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
314 + " sub_u32 $s2, $s1, $s2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
315 + " workitemid_u32 $s1, 0;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
316 + " add_u32 $s4, $s1, 128;"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
317 + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
318 + " cmp_lt_b1_u32 $c1, $s4, $s2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
319 + " cmp_lt_b1_s32 $c2, $s1, 128;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
320 + " and_b1 $c1, $c2, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
321 + " cvt_s64_s32 $d1, $s1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
322 + " shl_u64 $d1, $d1, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
323 + " lda_group_u64 $d2, [%reduce_cllocal_scratch];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
324 + " add_u64 $d1, $d2, $d1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
325 + " st_group_u32 $s3, [$d1];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
326 + " barrier_fgroup;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
327 + " not_b1 $c1, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
328 + " cbr $c1, @BB0_8;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
329 + " ld_group_u32 $s3, [$d1];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
330 + " cvt_s64_s32 $d3, $s4;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
331 + " shl_u64 $d3, $d3, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
332 + " add_u64 $d3, $d2, $d3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
333 + " ld_group_u32 $s4, [$d3];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
334 + reduceOp + " $s3, $s3, $s4;" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
335 + " st_group_u32 $s3, [$d1];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
336 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
337 + "@BB0_8:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
338 + " add_u32 $s3, $s1, 64;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
339 + " cmp_lt_b1_u32 $c1, $s3, $s2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
340 + " cmp_lt_b1_s32 $c2, $s1, 64;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
341 + " and_b1 $c1, $c2, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
342 + " barrier_fgroup;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
343 + " not_b1 $c1, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
344 + " cbr $c1, @BB0_10;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
345 + " ld_group_u32 $s4, [$d1];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
346 + " cvt_s64_s32 $d3, $s3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
347 + " shl_u64 $d3, $d3, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
348 + " add_u64 $d3, $d2, $d3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
349 + " ld_group_u32 $s3, [$d3];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
350 + reduceOp + " $s3, $s3, $s4;"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
351 + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
352 + " st_group_u32 $s3, [$d1];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
353 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
354 + "@BB0_10:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
355 + " add_u32 $s3, $s1, 32;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
356 + " cmp_lt_b1_u32 $c1, $s3, $s2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
357 + " cmp_lt_b1_s32 $c2, $s1, 32;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
358 + " and_b1 $c1, $c2, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
359 + " barrier_fgroup;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
360 + " not_b1 $c1, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
361 + " cbr $c1, @BB0_12;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
362 + " ld_group_u32 $s4, [$d1];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
363 + " cvt_s64_s32 $d3, $s3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
364 + " shl_u64 $d3, $d3, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
365 + " add_u64 $d3, $d2, $d3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
366 + " ld_group_u32 $s3, [$d3];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
367 + reduceOp + " $s3, $s3, $s4;" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
368 + " st_group_u32 $s3, [$d1];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
369 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
370 + "@BB0_12:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
371 + " add_u32 $s3, $s1, 16;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
372 + " cmp_lt_b1_u32 $c1, $s3, $s2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
373 + " cmp_lt_b1_s32 $c2, $s1, 16;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
374 + " and_b1 $c1, $c2, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
375 + " barrier_fgroup;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
376 + " not_b1 $c1, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
377 + " cbr $c1, @BB0_14;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
378 + " ld_group_u32 $s4, [$d1];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
379 + " cvt_s64_s32 $d3, $s3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
380 + " shl_u64 $d3, $d3, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
381 + " add_u64 $d3, $d2, $d3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
382 + " ld_group_u32 $s3, [$d3];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
383 + reduceOp + " $s3, $s3, $s4;" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
384 + " st_group_u32 $s3, [$d1];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
385 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
386 + "@BB0_14:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
387 + " add_u32 $s3, $s1, 8;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
388 + " cmp_lt_b1_u32 $c1, $s3, $s2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
389 + " cmp_lt_b1_s32 $c2, $s1, 8;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
390 + " and_b1 $c1, $c2, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
391 + " barrier_fgroup;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
392 + " not_b1 $c1, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
393 + " cbr $c1, @BB0_16;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
394 + " ld_group_u32 $s4, [$d1];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
395 + " cvt_s64_s32 $d3, $s3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
396 + " shl_u64 $d3, $d3, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
397 + " add_u64 $d3, $d2, $d3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
398 + " ld_group_u32 $s3, [$d3];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
399 + reduceOp + " $s3, $s3, $s4;" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
400 + " st_group_u32 $s3, [$d1];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
401 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
402 + "@BB0_16:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
403 + " add_u32 $s3, $s1, 4;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
404 + " cmp_lt_b1_u32 $c1, $s3, $s2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
405 + " cmp_lt_b1_s32 $c2, $s1, 4;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
406 + " and_b1 $c1, $c2, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
407 + " barrier_fgroup;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
408 + " not_b1 $c1, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
409 + " cbr $c1, @BB0_18;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
410 + " ld_group_u32 $s4, [$d1];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
411 + " cvt_s64_s32 $d3, $s3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
412 + " shl_u64 $d3, $d3, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
413 + " add_u64 $d3, $d2, $d3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
414 + " ld_group_u32 $s3, [$d3];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
415 + reduceOp + " $s3, $s3, $s4;" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
416 + " st_group_u32 $s3, [$d1];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
417 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
418 + "@BB0_18:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
419 + " add_u32 $s3, $s1, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
420 + " cmp_lt_b1_u32 $c1, $s3, $s2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
421 + " cmp_lt_b1_s32 $c2, $s1, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
422 + " and_b1 $c1, $c2, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
423 + " barrier_fgroup;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
424 + " not_b1 $c1, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
425 + " cbr $c1, @BB0_20;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
426 + " ld_group_u32 $s4, [$d1];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
427 + " cvt_s64_s32 $d3, $s3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
428 + " shl_u64 $d3, $d3, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
429 + " add_u64 $d3, $d2, $d3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
430 + " ld_group_u32 $s3, [$d3];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
431 + reduceOp + " $s3, $s3, $s4;" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
432 + " st_group_u32 $s3, [$d1];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
433 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
434 + "@BB0_20:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
435 + " add_u32 $s3, $s1, 1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
436 + " cmp_lt_b1_u32 $c1, $s3, $s2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
437 + " cmp_lt_b1_s32 $c2, $s1, 1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
438 + " and_b1 $c1, $c2, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
439 + " barrier_fgroup;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
440 + " not_b1 $c1, $c1;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
441 + " cbr $c1, @BB0_22;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
442 + " ld_group_u32 $s4, [$d1];" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
443 + " cvt_s64_s32 $d3, $s3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
444 + " shl_u64 $d3, $d3, 2;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
445 + " add_u64 $d2, $d2, $d3;" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
446 + " ld_group_u32 $s3, [$d2];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
447 + reduceOp + " $s3, $s3, $s4;" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
448 + " st_group_u32 $s3, [$d1];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
449 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
450 + "@BB0_22:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
451 + " cmp_gt_b1_u32 $c0, $s1, 0; // s1 is local id, done if > 0" + "\n"
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
452 + " cbr $c0, @BB0_24;" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
453 + "" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
454 + " ld_group_u32 $s2, [%reduce_cllocal_scratch]; // s2 is result[get_group_id(0)];" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
455 + atomicResultProduction + " [$d0], $s2; // build global result from local results" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
456 + "" + "\n"
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
457 + "@BB0_24:" + "\n"
18163
c88ab4f1f04a re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
458 + " ret;" + "\n"
16119
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
459 + "};" + "\n");
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
460 //@formatter:on
310994c667a7 HSAIL: support offloading some IntStream.reduce() operations to HSA
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
461 }
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
462 }