Java class for typeCgType. 17 | * 18 | *
The following schema fragment specifies the expected content contained within this class. 19 | *
20 | *
21 | * <simpleType name="typeCgType"> 22 | * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> 23 | * <enumeration value="pragma"/> 24 | * <enumeration value="functioncall"/> 25 | * <enumeration value="statement"/> 26 | * </restriction> 27 | * </simpleType> 28 | *29 | * 30 | */ 31 | @XmlEnum 32 | public enum TypeCgType { 33 | 34 | @XmlEnumValue("pragma") 35 | PRAGMA("pragma"), 36 | @XmlEnumValue("functioncall") 37 | FUNCTIONCALL("functioncall"), 38 | @XmlEnumValue("statement") 39 | STATEMENT("statement"); 40 | private final String value; 41 | 42 | TypeCgType(String v) { 43 | value = v; 44 | } 45 | 46 | public String value() { 47 | return value; 48 | } 49 | 50 | public static TypeCgType fromValue(String v) { 51 | for (TypeCgType c: TypeCgType.values()) { 52 | if (c.value.equals(v)) { 53 | return c; 54 | } 55 | } 56 | throw new IllegalArgumentException(v); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/ch/unibas/cs/hpwc/patus/arch/TypeRegisterType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2012.10.08 at 05:45:06 PM CEST 6 | // 7 | 8 | 9 | package ch.unibas.cs.hpwc.patus.arch; 10 | 11 | import javax.xml.bind.annotation.XmlEnum; 12 | import javax.xml.bind.annotation.XmlEnumValue; 13 | 14 | 15 | /** 16 | *
Java class for typeRegisterType. 17 | * 18 | *
The following schema fragment specifies the expected content contained within this class. 19 | *
20 | *
21 | * <simpleType name="typeRegisterType"> 22 | * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> 23 | * <enumeration value="gpr"/> 24 | * <enumeration value="fpr"/> 25 | * <enumeration value="simd"/> 26 | * </restriction> 27 | * </simpleType> 28 | *29 | * 30 | */ 31 | @XmlEnum 32 | public enum TypeRegisterType { 33 | 34 | @XmlEnumValue("gpr") 35 | GPR("gpr"), 36 | @XmlEnumValue("fpr") 37 | FPR("fpr"), 38 | @XmlEnumValue("simd") 39 | SIMD("simd"); 40 | private final String value; 41 | 42 | TypeRegisterType(String v) { 43 | value = v; 44 | } 45 | 46 | public String value() { 47 | return value; 48 | } 49 | 50 | public static TypeRegisterType fromValue(String v) { 51 | for (TypeRegisterType c: TypeRegisterType.values()) { 52 | if (c.value.equals(v)) { 53 | return c; 54 | } 55 | } 56 | throw new IllegalArgumentException(v); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/ch/unibas/cs/hpwc/patus/ast/BoundaryCheck.java: -------------------------------------------------------------------------------- 1 | package ch.unibas.cs.hpwc.patus.ast; 2 | 3 | import java.io.PrintWriter; 4 | 5 | import cetus.hir.Statement; 6 | 7 | public class BoundaryCheck extends Statement 8 | { 9 | /////////////////////////////////////////////////////////////////// 10 | // Member Variables 11 | 12 | private SubdomainIterator m_sdit; 13 | private Statement m_stmtWithChecks; 14 | private Statement m_stmtWithoutChecks; 15 | 16 | 17 | /////////////////////////////////////////////////////////////////// 18 | // Implementation 19 | 20 | public BoundaryCheck (SubdomainIterator it, Statement stmtWithChecks, Statement stmtWithoutChecks) 21 | { 22 | m_sdit = it; 23 | m_stmtWithChecks = stmtWithChecks; 24 | m_stmtWithoutChecks = stmtWithoutChecks; 25 | 26 | if (stmtWithChecks != null) 27 | addChild (stmtWithChecks); 28 | if (stmtWithoutChecks != null) 29 | addChild (stmtWithoutChecks); 30 | } 31 | 32 | public SubdomainIterator getSubdomainIterator () 33 | { 34 | return m_sdit; 35 | } 36 | 37 | public Statement getWithChecks () 38 | { 39 | return m_stmtWithChecks; 40 | } 41 | 42 | public Statement getWithoutChecks () 43 | { 44 | return m_stmtWithoutChecks; 45 | } 46 | 47 | public BoundaryCheck clone () 48 | { 49 | return new BoundaryCheck (m_sdit.clone (), m_stmtWithChecks.clone (), m_stmtWithoutChecks.clone ()); 50 | } 51 | 52 | @Override 53 | public void print (PrintWriter out) 54 | { 55 | out.print ("if (check_bnds ("); 56 | out.print (m_sdit.getIterator ().toString ()); 57 | out.println ("))"); 58 | m_stmtWithChecks.print (out); 59 | out.println ("\nelse"); 60 | m_stmtWithoutChecks.print (out); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/ch/unibas/cs/hpwc/patus/ast/IStatementList.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the GNU Lesser Public License v2.1 5 | * which accompanies this distribution, and is available at 6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 7 | * 8 | * Contributors: 9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation 10 | ******************************************************************************/ 11 | package ch.unibas.cs.hpwc.patus.ast; 12 | 13 | import cetus.hir.Declaration; 14 | import cetus.hir.Statement; 15 | 16 | public interface IStatementList 17 | { 18 | /** 19 | * 20 | * @param stmt 21 | */ 22 | public abstract void addStatement (Statement stmt); 23 | 24 | /** 25 | * 26 | * @param declaration 27 | */ 28 | public abstract void addDeclaration (Declaration declaration); 29 | 30 | public void addStatementAtTop (Statement stmt); 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/ch/unibas/cs/hpwc/patus/ast/UniqueStatementList.java: -------------------------------------------------------------------------------- 1 | package ch.unibas.cs.hpwc.patus.ast; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | import cetus.hir.Statement; 7 | 8 | public class UniqueStatementList extends StatementList 9 | { 10 | /////////////////////////////////////////////////////////////////// 11 | // Member Variables 12 | 13 | private Set
true
iff the instance of the code generator requires
27 | * the assembly specification
28 | */
29 | public abstract boolean requiresAssemblySection ();
30 | }
31 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/IInternalAutotuningParameters.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.codegen;
12 |
13 | /**
14 | *
15 | * @author Matthias-M. Christen
16 | */
17 | public interface IInternalAutotuningParameters
18 | {
19 | public final static String LOOP_UNROLLING = "loop_unrolling";
20 |
21 | public final static String PADDING = "padding";
22 | }
23 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/ProjectionMask.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.codegen;
12 |
13 | import cetus.hir.Expression;
14 | import ch.unibas.cs.hpwc.patus.ast.SubdomainIterator;
15 | import ch.unibas.cs.hpwc.patus.geometry.Vector;
16 | import ch.unibas.cs.hpwc.patus.util.ExpressionUtil;
17 |
18 | public class ProjectionMask extends AbstractMask
19 | {
20 | ///////////////////////////////////////////////////////////////////
21 | // Implementation
22 |
23 | public ProjectionMask (SubdomainIterator it)
24 | {
25 | this (it.getIteratorSubdomain ().getBox ().getSize ().getCoords ());
26 | }
27 |
28 | public ProjectionMask (Vector v)
29 | {
30 | this (v.getCoords ());
31 | }
32 |
33 | public ProjectionMask (Expression[] rgExpressions)
34 | {
35 | super (rgExpressions);
36 | }
37 |
38 | @Override
39 | protected int[] createMask (Expression[] rgExpressions)
40 | {
41 | int[] rgMask = new int[rgExpressions.length];
42 | for (int i = 0; i < rgExpressions.length; i++)
43 | rgMask[i] = ExpressionUtil.isValue (rgExpressions[i], 1) ? 1 : 0;
44 | return rgMask;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/ProjectionUnmask.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.codegen;
12 |
13 | import cetus.hir.Expression;
14 | import ch.unibas.cs.hpwc.patus.ast.SubdomainIterator;
15 | import ch.unibas.cs.hpwc.patus.geometry.Vector;
16 |
17 | /**
18 | *
19 | * @author Matthias-M. Christen
20 | */
21 | public class ProjectionUnmask extends InverseMask
22 | {
23 | ///////////////////////////////////////////////////////////////////
24 | // Implementation
25 |
26 | public ProjectionUnmask (SubdomainIterator it)
27 | {
28 | this (it.getIteratorSubdomain ().getBox ().getSize ().getCoords ());
29 | }
30 |
31 | public ProjectionUnmask (Vector v)
32 | {
33 | this (v.getCoords ());
34 | }
35 |
36 | public ProjectionUnmask (Expression[] rgExpressions)
37 | {
38 | super (rgExpressions, ProjectionMask.class);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/ReuseUnmask.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.codegen;
12 |
13 | import cetus.hir.Expression;
14 | import ch.unibas.cs.hpwc.patus.ast.SubdomainIterator;
15 | import ch.unibas.cs.hpwc.patus.geometry.Vector;
16 |
17 | public class ReuseUnmask extends InverseMask
18 | {
19 | ///////////////////////////////////////////////////////////////////
20 | // Implementation
21 |
22 | public ReuseUnmask (SubdomainIterator it)
23 | {
24 | this (it.getIteratorSubdomain ().getBox ().getSize ().getCoords ());
25 | }
26 |
27 | public ReuseUnmask (Vector v)
28 | {
29 | this (v.getCoords ());
30 | }
31 |
32 | public ReuseUnmask (Expression[] rgExpressions)
33 | {
34 | super (rgExpressions, ReuseMask.class);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/IAdditionalKernelSpecific.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.codegen.backend;
12 |
13 | public interface IAdditionalKernelSpecific
14 | {
15 | /**
16 | * Returns a string with additional code to be added after the includes and before the actual kernel code.
17 | * @return Additional code
18 | */
19 | public abstract String getAdditionalKernelSpecificCode ();
20 | }
21 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/IBackend.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.codegen.backend;
12 |
13 | import ch.unibas.cs.hpwc.patus.codegen.KernelSourceFile;
14 |
15 | /**
16 | * The backend code generator.
17 | * @author Matthias-M. Christen
18 | */
19 | public interface IBackend extends IParallel, IDataTransfer, IIndexing, IArithmetic, IAdditionalKernelSpecific, INonKernelFunctions
20 | {
21 | /**
22 | *
23 | * @param ksf
24 | */
25 | public abstract void setKernelSourceFile (KernelSourceFile ksf);
26 | }
27 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/IParallel.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.codegen.backend;
12 |
13 | import cetus.hir.Statement;
14 |
15 | /**
16 | * Hardware-/programming model-specific parallelization intrinsics
17 | * (that are used for stencil kernel code generation).
18 | *
19 | * @author Matthias-M. Christen
20 | */
21 | public interface IParallel
22 | {
23 | /**
24 | * Implements a barrier.
25 | */
26 | public abstract Statement getBarrier (int nParallelismLevel);
27 | }
28 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/IndexingLevelUtil.java:
--------------------------------------------------------------------------------
1 | package ch.unibas.cs.hpwc.patus.codegen.backend;
2 |
3 | import ch.unibas.cs.hpwc.patus.codegen.backend.IIndexing.IIndexingLevel;
4 |
5 | public class IndexingLevelUtil
6 | {
7 | /**
8 | * Converts the parallelism level to an indexing level and returns the corresponding indexing
9 | * level object.
10 | * The lowest parallelism level is assigned to the outer-most loop, which corresponds to the
11 | * highest indexing level.
12 | * @param indexing
13 | * @param nParallelismLevel
14 | * @return
15 | */
16 | public static IIndexingLevel getIndexingLevelFromParallelismLevel (IIndexing indexing, int nParallelismLevel)
17 | {
18 | int nIndexingLevelsCount = indexing.getIndexingLevelsCount ();
19 | if (nParallelismLevel <= 0)
20 | return indexing.getIndexingLevel (nIndexingLevelsCount - 1);
21 | if (nParallelismLevel >= nIndexingLevelsCount)
22 | return indexing.getIndexingLevel (0);
23 | return indexing.getIndexingLevel (nIndexingLevelsCount - nParallelismLevel);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/assembly/AbstractInstruction.java:
--------------------------------------------------------------------------------
1 | package ch.unibas.cs.hpwc.patus.codegen.backend.assembly;
2 |
3 | import ch.unibas.cs.hpwc.patus.ast.ParameterAssignment;
4 |
5 | public abstract class AbstractInstruction implements IInstruction
6 | {
7 | ///////////////////////////////////////////////////////////////////
8 | // Member Variables
9 |
10 | protected ParameterAssignment m_pa;
11 |
12 |
13 | ///////////////////////////////////////////////////////////////////
14 | // Implementation
15 |
16 | public AbstractInstruction ()
17 | {
18 | m_pa = null;
19 | }
20 |
21 | @Override
22 | public void setParameterAssignment (ParameterAssignment pa)
23 | {
24 | m_pa = pa;
25 | }
26 |
27 | @Override
28 | public ParameterAssignment getParameterAssignment ()
29 | {
30 | return m_pa;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/assembly/AddSub.java:
--------------------------------------------------------------------------------
1 | package ch.unibas.cs.hpwc.patus.codegen.backend.assembly;
2 |
3 | import cetus.hir.BinaryOperator;
4 | import cetus.hir.Expression;
5 | import ch.unibas.cs.hpwc.patus.arch.TypeBaseIntrinsicEnum;
6 | import ch.unibas.cs.hpwc.patus.codegen.Globals;
7 | import ch.unibas.cs.hpwc.patus.util.StringUtil;
8 |
9 | /**
10 | *
11 | * @author Matthias-M. Christen
12 | */
13 | class AddSub
14 | {
15 | ///////////////////////////////////////////////////////////////////
16 | // Member Variables
17 |
18 | private Expression m_expr;
19 | private BinaryOperator m_op;
20 |
21 |
22 | ///////////////////////////////////////////////////////////////////
23 | // Implementation
24 |
25 | public AddSub (BinaryOperator op, Expression expr)
26 | {
27 | m_op = op;
28 | m_expr = expr;
29 | }
30 |
31 | public Expression getExpression ()
32 | {
33 | return m_expr;
34 | }
35 |
36 | public TypeBaseIntrinsicEnum getBaseIntrinsic ()
37 | {
38 | return Globals.getIntrinsicBase (m_op);
39 | }
40 |
41 | public BinaryOperator getOperator ()
42 | {
43 | return m_op;
44 | }
45 |
46 | @Override
47 | public String toString ()
48 | {
49 | return StringUtil.concat (m_op.toString (), m_expr.toString ());
50 | }
51 | }
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/assembly/AssemblyParameters.java:
--------------------------------------------------------------------------------
1 | package ch.unibas.cs.hpwc.patus.codegen.backend.assembly;
2 |
3 | public class AssemblyParameters
4 | {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/assembly/Comment.java:
--------------------------------------------------------------------------------
1 | package ch.unibas.cs.hpwc.patus.codegen.backend.assembly;
2 |
3 | import java.util.Map;
4 |
5 | import ch.unibas.cs.hpwc.patus.arch.TypeBaseIntrinsicEnum;
6 | import ch.unibas.cs.hpwc.patus.ast.ParameterAssignment;
7 | import ch.unibas.cs.hpwc.patus.util.StringUtil;
8 |
9 | public class Comment extends AbstractInstruction
10 | {
11 | private String m_strComment;
12 |
13 |
14 | public Comment (String strComment)
15 | {
16 | m_strComment = strComment;
17 | }
18 |
19 | public Comment (String strComment, ParameterAssignment pa)
20 | {
21 | this (strComment);
22 | setParameterAssignment (pa);
23 | }
24 |
25 | @Override
26 | public void issue (StringBuilder sbResult)
27 | {
28 | sbResult.append ("/* ");
29 | sbResult.append (m_strComment);
30 | sbResult.append (" */");
31 | }
32 |
33 | @Override
34 | public TypeBaseIntrinsicEnum getIntrinsic ()
35 | {
36 | // this instruction doesn't correspond to an intrinsic
37 | return null;
38 | }
39 |
40 | @Override
41 | public String toString ()
42 | {
43 | return StringUtil.concat ("/* ", m_strComment, " */");
44 | }
45 |
46 | @Override
47 | public String toJavaCode (MapsbResult
.
18 | *
19 | * @param sbResult
20 | * The string builder to which the result is added
21 | */
22 | public abstract void issue (StringBuilder sbResult);
23 |
24 | /**
25 | * Returns the intrinsic corresponding to this instruction or
26 | * null
if the instruction doesn't correspond to an intrinsic
27 | * defined in the architecture description.
28 | *
29 | * @return The intrinsic corresponding to this instruction
30 | */
31 | public abstract TypeBaseIntrinsicEnum getIntrinsic ();
32 |
33 | /**
34 | * Returns the Java code to create this instruction.
35 | * @return
36 | */
37 | public abstract String toJavaCode (Mapil
.
13 | * @param il The instruction list to optimize
14 | * @return The optimized instruction list
15 | */
16 | public abstract InstructionList optimize (InstructionList il);
17 | }
18 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/assembly/optimize/InstructionScheduleOptimizer.java:
--------------------------------------------------------------------------------
1 | package ch.unibas.cs.hpwc.patus.codegen.backend.assembly.optimize;
2 |
3 | import cetus.hir.Specifier;
4 | import ch.unibas.cs.hpwc.patus.arch.IArchitectureDescription;
5 | import ch.unibas.cs.hpwc.patus.codegen.backend.assembly.InstructionList;
6 | import ch.unibas.cs.hpwc.patus.codegen.backend.assembly.InstructionScheduler;
7 | import ch.unibas.cs.hpwc.patus.codegen.backend.assembly.analyze.DependenceAnalysis;
8 |
9 | public class InstructionScheduleOptimizer implements IInstructionListOptimizer
10 | {
11 | private IArchitectureDescription m_arch;
12 | private Specifier m_specDatatype;
13 |
14 | public InstructionScheduleOptimizer (IArchitectureDescription arch, Specifier specDatatype)
15 | {
16 | m_arch = arch;
17 | m_specDatatype = specDatatype;
18 | }
19 |
20 | @Override
21 | public InstructionList optimize (InstructionList il)
22 | {
23 | return new InstructionScheduler (new DependenceAnalysis (il, m_arch).run (m_specDatatype), m_arch).schedule ();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/assembly/p121-wilken.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthias-christen/patus/306dd3b93d8d3a1477592c6fc65dd3b7f297a23a/src/ch/unibas/cs/hpwc/patus/codegen/backend/assembly/p121-wilken.pdf
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/assembly/translate-instructions.ods:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthias-christen/patus/306dd3b93d8d3a1477592c6fc65dd3b7f297a23a/src/ch/unibas/cs/hpwc/patus/codegen/backend/assembly/translate-instructions.ods
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/cuda/CUDA1DCodeGenerator.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.codegen.backend.cuda;
12 |
13 | import ch.unibas.cs.hpwc.patus.codegen.CodeGeneratorSharedObjects;
14 |
15 | /**
16 | *
17 | * @author Matthias-M. Christen
18 | */
19 | public class CUDA1DCodeGenerator extends AbstractCUDACodeGenerator
20 | {
21 | ///////////////////////////////////////////////////////////////////
22 | // Implementation
23 |
24 | public CUDA1DCodeGenerator (CodeGeneratorSharedObjects data)
25 | {
26 | super (data);
27 | }
28 |
29 | @Override
30 | protected int getIndexingLevelDimensionality (int nIndexingLevel)
31 | {
32 | return 1;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/cuda/CUDA4CodeGenerator.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.codegen.backend.cuda;
12 |
13 | import ch.unibas.cs.hpwc.patus.codegen.CodeGeneratorSharedObjects;
14 |
15 | public class CUDA4CodeGenerator extends AbstractCUDACodeGenerator
16 | {
17 | ///////////////////////////////////////////////////////////////////
18 | // Constants
19 |
20 | /**
21 | * CUDA 4.0 and above allow (3, 3)-indexing on Fermi cards
22 | */
23 | private final static int[] INDEXING_LEVEL_DIMENSIONALITIES = new int[] { 3, 3 };
24 |
25 |
26 | ///////////////////////////////////////////////////////////////////
27 | // Implementation
28 |
29 | public CUDA4CodeGenerator (CodeGeneratorSharedObjects data)
30 | {
31 | super (data);
32 | }
33 |
34 | @Override
35 | protected int getIndexingLevelDimensionality (int nIndexingLevel)
36 | {
37 | return INDEXING_LEVEL_DIMENSIONALITIES[nIndexingLevel];
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/cuda/CUDACodeGenerator.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.codegen.backend.cuda;
12 |
13 | import ch.unibas.cs.hpwc.patus.codegen.CodeGeneratorSharedObjects;
14 |
15 | /**
16 | *
17 | * @author Matthias-M. Christen
18 | */
19 | public class CUDACodeGenerator extends AbstractCUDACodeGenerator
20 | {
21 | ///////////////////////////////////////////////////////////////////
22 | // Constants
23 |
24 | private final static int[] INDEXING_LEVEL_DIMENSIONALITIES = new int[] { 3, 2 };
25 |
26 |
27 | ///////////////////////////////////////////////////////////////////
28 | // Implementation
29 |
30 | public CUDACodeGenerator (CodeGeneratorSharedObjects data)
31 | {
32 | super (data);
33 | }
34 |
35 | @Override
36 | protected int getIndexingLevelDimensionality (int nIndexingLevel)
37 | {
38 | return INDEXING_LEVEL_DIMENSIONALITIES[nIndexingLevel];
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/intel/TestIntelXeonCodeGenerator.java:
--------------------------------------------------------------------------------
1 | package ch.unibas.cs.hpwc.patus.codegen.backend.intel;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.junit.Test;
6 |
7 | import cetus.hir.Specifier;
8 |
9 | public class TestIntelXeonCodeGenerator {
10 |
11 | @Test
12 | public void TestgetVecLoadFunctionNameFloat() {
13 | IntelXeonCodeGenerator cg = new IntelXeonCodeGenerator(null);
14 |
15 | assertEquals(cg.getVecLoadFunctionName(Specifier.FLOAT),
16 | "_mm512_extload_ps");
17 | }
18 |
19 | @Test
20 | public void TestgetVecLoadFunctionNameDouble() {
21 | IntelXeonCodeGenerator cg = new IntelXeonCodeGenerator(null);
22 |
23 | assertEquals(cg.getVecLoadFunctionName(Specifier.DOUBLE),
24 | "_mm512_extload_pd");
25 | }
26 |
27 | @Test
28 | public void TesthasVecLoadFunctionPointerArg(){
29 | IntelXeonCodeGenerator cg = new IntelXeonCodeGenerator(null);
30 | assertEquals(true, cg.hasVecLoadFunctionPointerArg());
31 | }
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/openmp/OpenMPAVXAsmCodeGenerator.java:
--------------------------------------------------------------------------------
1 | package ch.unibas.cs.hpwc.patus.codegen.backend.openmp;
2 |
3 | import cetus.hir.Expression;
4 | import cetus.hir.Specifier;
5 | import ch.unibas.cs.hpwc.patus.codegen.CodeGeneratorSharedObjects;
6 |
7 | public class OpenMPAVXAsmCodeGenerator extends OpenMPAVXCodeGenerator
8 | {
9 | public OpenMPAVXAsmCodeGenerator (CodeGeneratorSharedObjects data)
10 | {
11 | super (data);
12 | }
13 |
14 | @Override
15 | public Expression unary_minus (Expression expr, Specifier specDatatype, boolean bVectorize)
16 | {
17 | return super.unary_minus (expr, specDatatype, bVectorize);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/codegen/backend/openmp/test_avxselect.c:
--------------------------------------------------------------------------------
1 | #include int
array
19 | */
20 | public abstract int[] getSpaceIndex ();
21 | }
22 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/symbolic/IMaximaConfiguration.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | /* $Id$
12 | *
13 | * Copyright (c) 2010, The University of Edinburgh.
14 | * All Rights Reserved
15 | */
16 | package ch.unibas.cs.hpwc.patus.symbolic;
17 |
18 | /**
19 | * Interface for a class which provides configuration details for connecting to
20 | * Maxima.
21 | *
22 | * @see HardCodedMaximaConfiguration
23 | * @see PropertiesMaximaConfiguration
24 | *
25 | * @author David McKain
26 | * @version $Revision$
27 | */
28 | public interface IMaximaConfiguration
29 | {
30 | /**
31 | * Returns the path where Maxima is installed.
32 | * @return The path to Maxima
33 | */
34 | String getMaximaExecutablePath ();
35 |
36 | /**
37 | * An array of environment variables, in the format varname=value.
38 | * @return
39 | */
40 | String[] getMaximaRuntimeEnvironment ();
41 |
42 | /**
43 | * The default call timeout in seconds.
44 | * @return
45 | */
46 | int getDefaultCallTimeout ();
47 | }
48 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/symbolic/NotConvertableException.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2011 Matthias-M. Christen, University of Basel, Switzerland.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the GNU Lesser Public License v2.1
5 | * which accompanies this distribution, and is available at
6 | * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 | *
8 | * Contributors:
9 | * Matthias-M. Christen, University of Basel, Switzerland - initial API and implementation
10 | ******************************************************************************/
11 | package ch.unibas.cs.hpwc.patus.symbolic;
12 |
13 | import cetus.hir.Expression;
14 |
15 | /**
16 | *
17 | * @author Matthias-M. Christen
18 | */
19 | public class NotConvertableException extends Exception
20 | {
21 | private static final long serialVersionUID = 1L;
22 |
23 |
24 | ///////////////////////////////////////////////////////////////////
25 | // Member Variables
26 |
27 |
28 | ///////////////////////////////////////////////////////////////////
29 | // Implementation
30 |
31 | public NotConvertableException ()
32 | {
33 | super ();
34 | }
35 |
36 | public NotConvertableException (String s)
37 | {
38 | super (s);
39 | }
40 |
41 | public NotConvertableException (Expression expr)
42 | {
43 | super ("The expression " + expr.toString () + " can't be converted to a Maxima expression");
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/util/IParallelOperation.java:
--------------------------------------------------------------------------------
1 | package ch.unibas.cs.hpwc.patus.util;
2 |
3 | public interface IParallelOperationelement
.
7 | *
8 | * @param element
9 | * The element on which to perform the operation
10 | */
11 | public abstract void perform (T element);
12 | }
13 |
--------------------------------------------------------------------------------
/src/ch/unibas/cs/hpwc/patus/util/StringUtilTest.java:
--------------------------------------------------------------------------------
1 | package ch.unibas.cs.hpwc.patus.util;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.junit.Test;
6 |
7 | public class StringUtilTest
8 | {
9 | @Test
10 | public void testTrimLeft ()
11 | {
12 | assertEquals ("test", StringUtil.trimLeft ("test", new char[] { '_' }));
13 | assertEquals ("test", StringUtil.trimLeft ("_test", new char[] { '_' }));
14 | assertEquals ("test", StringUtil.trimLeft ("__test", new char[] { '_' }));
15 | assertEquals ("test", StringUtil.trimLeft ("_#test", new char[] { '_', '#' }));
16 | assertEquals ("", StringUtil.trimLeft ("___", new char[] { '_' }));
17 | assertEquals ("test_", StringUtil.trimLeft ("_test_", new char[] { '_' }));
18 | }
19 |
20 | @Test
21 | public void testTrimRight ()
22 | {
23 | assertEquals ("test", StringUtil.trimRight ("test", new char[] { '_' }));
24 | assertEquals ("test", StringUtil.trimRight ("test__", new char[] { '_' }));
25 | assertEquals ("test", StringUtil.trimRight ("test#_", new char[] { '_', '#' }));
26 | assertEquals ("", StringUtil.trimRight ("___", new char[] { '_' }));
27 | assertEquals ("_test", StringUtil.trimRight ("_test_", new char[] { '_' }));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/log4j.properties:
--------------------------------------------------------------------------------
1 | # direct log messages to stdout
2 |
3 | # for release
4 | log4j.rootLogger=DEBUG, stdout
5 | log4j.appender.stdout.layout.ConversionPattern=(%p) %m%n
6 |
7 | # for debugging
8 | #log4j.rootLogger=debug, stdout
9 | #log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} (%5p) %c{1}:%L - %m%n
10 |
11 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
12 | log4j.appender.stdout.Target=System.out
13 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
14 |
--------------------------------------------------------------------------------
/src_jni/ch_unibas_cs_hpwc_patus_ilp_ILPModel_EOperator.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #include