graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILCompilationResult.java

Print this page




  81             }
  82         };
  83         consoleHandler.setFormatter(formatter);
  84         logger.setLevel(logLevel);
  85         consoleHandler.setLevel(logLevel);
  86     }
  87 
  88     public static HSAILCompilationResult getHSAILCompilationResult(Method meth) {
  89         ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(meth);
  90         return getHSAILCompilationResult(javaMethod);
  91     }
  92 
  93     public static HSAILCompilationResult getHSAILCompilationResult(ResolvedJavaMethod javaMethod) {
  94         StructuredGraph graph = new StructuredGraph(javaMethod);
  95         new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph);
  96         return getHSAILCompilationResult(graph);
  97     }
  98 
  99     public static HSAILCompilationResult getHSAILCompilationResult(StructuredGraph graph) {
 100         Debug.dump(graph, "Graph");
 101         TargetDescription target = new TargetDescription(new HSAIL(), true, 1, 0, true);
 102         HSAILBackend hsailBackend = new HSAILBackend(Graal.getRequiredCapability(GraalCodeCacheProvider.class), target);
 103         PhasePlan phasePlan = new PhasePlan();
 104         GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE);
 105         phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
 106         phasePlan.addPhase(PhasePosition.AFTER_PARSING, new HSAILPhase());
 107         new HSAILPhase().apply(graph);
 108         CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
 109         try {
 110             CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, hsailBackend, target, null, phasePlan, OptimisticOptimizations.NONE,
 111                             new SpeculationLog(), suitesProvider.getDefaultSuites(), new CompilationResult());
 112             return new HSAILCompilationResult(compResult);
 113         } catch (GraalInternalError e) {
 114             String partialCode = hsailBackend.getPartialCodeString();
 115             if (partialCode != null && !partialCode.equals("")) {
 116                 logger.fine("-------------------\nPartial Code Generation:\n--------------------");
 117                 logger.fine(partialCode);
 118                 logger.fine("-------------------\nEnd of Partial Code Generation\n--------------------");
 119             }
 120             throw e;
 121         }




  81             }
  82         };
  83         consoleHandler.setFormatter(formatter);
  84         logger.setLevel(logLevel);
  85         consoleHandler.setLevel(logLevel);
  86     }
  87 
  88     public static HSAILCompilationResult getHSAILCompilationResult(Method meth) {
  89         ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(meth);
  90         return getHSAILCompilationResult(javaMethod);
  91     }
  92 
  93     public static HSAILCompilationResult getHSAILCompilationResult(ResolvedJavaMethod javaMethod) {
  94         StructuredGraph graph = new StructuredGraph(javaMethod);
  95         new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph);
  96         return getHSAILCompilationResult(graph);
  97     }
  98 
  99     public static HSAILCompilationResult getHSAILCompilationResult(StructuredGraph graph) {
 100         Debug.dump(graph, "Graph");
 101         TargetDescription target = new TargetDescription(new HSAIL(), true, 8, 0, true);
 102         HSAILBackend hsailBackend = new HSAILBackend(Graal.getRequiredCapability(GraalCodeCacheProvider.class), target);
 103         PhasePlan phasePlan = new PhasePlan();
 104         GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE);
 105         phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
 106         phasePlan.addPhase(PhasePosition.AFTER_PARSING, new HSAILPhase());
 107         new HSAILPhase().apply(graph);
 108         CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
 109         try {
 110             CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, hsailBackend, target, null, phasePlan, OptimisticOptimizations.NONE,
 111                             new SpeculationLog(), suitesProvider.getDefaultSuites(), new CompilationResult());
 112             return new HSAILCompilationResult(compResult);
 113         } catch (GraalInternalError e) {
 114             String partialCode = hsailBackend.getPartialCodeString();
 115             if (partialCode != null && !partialCode.equals("")) {
 116                 logger.fine("-------------------\nPartial Code Generation:\n--------------------");
 117                 logger.fine(partialCode);
 118                 logger.fine("-------------------\nEnd of Partial Code Generation\n--------------------");
 119             }
 120             throw e;
 121         }