Skip to content

Commit

Permalink
[MatlabToCLV2Tests] Adds project
Browse files Browse the repository at this point in the history
  • Loading branch information
joaobispo committed Oct 8, 2021
1 parent 6cf8072 commit 242aba4
Show file tree
Hide file tree
Showing 34 changed files with 2,240 additions and 0 deletions.
18 changes: 18 additions & 0 deletions MatlabToCLV2Tests/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry combineaccessrules="false" kind="src" path="/MatlabToCLV2"/>
<classpathentry combineaccessrules="false" kind="src" path="/SpecsUtils"/>
<classpathentry combineaccessrules="false" kind="src" path="/MatisseLib"/>
<classpathentry combineaccessrules="false" kind="src" path="/MatisseLibTests"/>
<classpathentry combineaccessrules="false" kind="src" path="/jOptions"/>
<classpathentry combineaccessrules="false" kind="src" path="/CIR"/>
<classpathentry combineaccessrules="false" kind="src" path="/MatlabProcessor"/>
<classpathentry combineaccessrules="false" kind="src" path="/MatlabIR"/>
<classpathentry combineaccessrules="false" kind="src" path="/MatisseInterface"/>
<classpathentry combineaccessrules="false" kind="src" path="/MatlabToCLib"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
18 changes: 18 additions & 0 deletions MatlabToCLV2Tests/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MatlabToCLV2Tests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.apache.ivyde.eclipse.ivynature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions MatlabToCLV2Tests/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Function test
block #0:
line 1
line 2
A$1 = arg 0
line 3
A$2 = arg 1
line 4
parallel_block schedule(direct) sum_reduction_strategy(simple) #1, #2
block #1:
A$3 = A$1
line 5
y$ret = A$2
block #2:
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Function test
block #0:
line 2
A$1 = arg 0
line 3
A$2 = arg 1
line 1
$fixed_work_groups$1 = 4
parallel_block schedule(fixed_work_groups_sequential, $fixed_work_groups$1) sum_reduction_strategy(simple) #1, #2
block #1:
line 4
A$3 = A$1
line 5
y$ret = A$2
block #2:
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Function test
block #0:
line 1
line 3
A$1 = arg 0
parallel_block schedule(direct) sum_reduction_strategy(simple) #4, #5
block #1:
% If
block #2:
% Else
block #3:
% End if
A$3 = A$1
block #4:
branch A$1, #1, #2, #3
block #5:
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Function test
block #0:
line 1
line 3
A$1 = arg 0
parallel_block schedule(direct) sum_reduction_strategy(simple) #3, #4
block #1:
% For
A$for = phi #3:A$1, #1:A$for
block #2:
% End for
A$ret = phi #3:A$1, #1:A$for
block #3:
for A$1, A$1, A$1, #1, #2
block #4:
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Function test
block #0:
A$1 = arg 0
parallel_block schedule(direct) sum_reduction_strategy(simple) #4, #5
block #1:
% If
block #2:
% Else
block #3:
% End if
block #4:
branch A$1, #1, #2, #3
block #5:
A$3 = A$1
8 changes: 8 additions & 0 deletions MatlabToCLV2Tests/resources/directive/blockbuilder/region.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Function test
block #0:
A$1 = arg 0
parallel_block schedule(direct) sum_reduction_strategy(simple) #1, #2
block #1:
A$2 = A$1
block #2:
A$3 = A$2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
block #0:
$one$1 = 1
$arg$1 = arg 0
$mat$1 = call matisse_new_array_from_dims [DynamicMatrixType(DOUBLE weak, shape=[Matrix Shape: [1, -1], Dims: 1])] $one$1, $arg$1
$mat_gpu$1 = copy_to_gpu $mat$1
$mat_gpu$2 = copy_to_gpu $mat$1
invoke_kernel kernel1 [], $mat_gpu$1, $mat_gpu$2
$mat$2 = complete_reduction MATRIX_SET $mat_gpu$2, null, $mat$1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
block #0:
$int$1 = 1234
$mat$1 = call matisse_new_array_from_dims [DynamicMatrixType(DOUBLE weak, shape=[Matrix Shape: [1234, 1234], Dims: 2])] $int$1, $int$1
$begin$1 = 1
$numel_result$1 = call numel [INT (1522756)] $mat$1
$value$1 = 0
$mat_gpu$1 = copy_to_gpu $mat$1
set_gpu_range $mat_gpu$1, $begin$1, $numel_result$1, $value$1
$mat$2 = complete_reduction MATRIX_SET $mat_gpu$1, null, $mat$1
$buffer$1 = copy_to_gpu $mat$2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
block #0:
$int$1 = 1234
$mat$1 = call matisse_new_array_from_dims [DynamicMatrixType(DOUBLE weak, shape=[Matrix Shape: [1234, 1234], Dims: 2])] $int$1, $int$1
$begin$1 = 1
$numel_result$1 = call numel [INT (1522756)] $mat$1
$value$1 = 0
mat$ret = set_gpu_range $mat$1, $begin$1, $numel_result$1, $value$1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
block #0:
arg$1 = arg 0
arg$2 = arg 0
out$1 = complete_reduction MATRIX_SET arg$2, null, arg$1
numel$1 = end arg$1, 0, 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
block #0:
arg$1 = arg 0
arg$2 = arg 0
result$ret = complete_reduction MATRIX_SET arg$2, null, arg$1
numel$1 = untyped_call numel result$ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
block #0:
arg$1 = arg 0
arg$2 = arg 0
out$1 = complete_reduction MATRIX_SET arg$2, null, arg$1
numel$1 = untyped_call numel arg$1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
block #0:
$m$1 = arg 0
$buf$1 = arg 1
arg$1 = arg 2
$one$1 = 1
$m$2 = complete_reduction MATRIX_SET $buf$1, null, $m$1
for $one$1, $one$1, $arg$1, #1, #2
block #1:
$m$3 = phi #0:$m$2, #5:$m$4
branch $one$1, #3, #4, #5
block #2:
$m$5 = phi #0:$m$2, #5:$m$4
$result$1 = $buf$1
block #3:

block #4:

block #5:
$test$1 = $buf$1
$m$4 = complete_reduction MATRIX_SET $buf$1, null, $m$3
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
block #0:
$m$1 = arg 0
$buf$1 = arg 1
arg$1 = arg 2
$one$1 = 1
$m$2 = complete_reduction MATRIX_SET $buf$1, null, $m$1
for $one$1, $one$1, $arg$1, #1, #2
block #1:
$m$3 = phi #0:$m$2, #4:$m$4
for $one$1, $one$1, $one$1, #3, #4
block #2:
$m$5 = phi #0:$m$2, #4:$m$4
$result$1 = $buf$1
block #3:

block #4:
$test$1 = $buf$1
$m$4 = complete_reduction MATRIX_SET $buf$1, null, $m$3
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
block #0:
$m$1 = arg 0
$buf$1 = arg 1
arg$1 = arg 2
$one$1 = 1
$m$2 = complete_reduction MATRIX_SET $buf$1, null, $m$1
for $one$1, $one$1, $arg$1, #1, #2
block #1:
$m$3 = phi #0:$m$2, #1:$m$4
$test$1 = $buf$1
$m$4 = complete_reduction MATRIX_SET $buf$1, null, $m$3
block #2:
$m$5 = phi #0:$m$2, #1:$m$4
$result$1 = $buf$1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
block #0:
arg$1 = arg 0
arg$2 = arg 1
$mat$1 = complete_reduction MATRIX_SET arg$1, null, arg$2
$stuff$1 = arg$1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright 2017 SPeCS.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License. under the License.
*/

package org.specs.matlabtocl.v2.tests;

import java.util.Arrays;
import java.util.HashMap;

import org.specs.matlabtocl.v2.codegen.ReductionType;
import org.specs.matlabtocl.v2.codegen.reductionstrategies.SumReductionStrategy;
import org.specs.matlabtocl.v2.ssa.ParallelRegionSettings;
import org.specs.matlabtocl.v2.ssa.ScheduleStrategy;

public class CLTestUtils {
public static ParallelRegionSettings buildDummySettings() {
ParallelRegionSettings settings = new ParallelRegionSettings();

settings.schedule = ScheduleStrategy.DIRECT;
settings.reductionStrategies = new HashMap<>();
settings.reductionStrategies.put(ReductionType.SUM,
Arrays.asList(SumReductionStrategy.SIMPLE_SUM_REDUCTION.buildInstance()));

return settings;
}
}
Loading

0 comments on commit 242aba4

Please sign in to comment.