コード例 #1
0
def test_stride2x3(request, tensile_client_dir, tmp_path):
    z = {}  # problemType definition
    conv = Convolution(z,
                       'ConvolutionForward',
                       config={
                           'TensorAFormat': 'NCHW',
                           'Filter': '1x1',
                           'Stride': '2x3',
                           'Dilation': '1x1',
                           'Spatial': '17x31',
                       })
    log.debug(conv.printUsage(z))
    YamlBuilder.run_convolution_vs_contraction(request, conv, z,
                                               tensile_client_dir, tmp_path)
コード例 #2
0
def test_nchw_backwardweights_filter3x5(request, tensile_client_dir, tmp_path):
    z = {}  # problemType definition
    conv = Convolution(z,
                       'ConvolutionBackwardWeights',
                       config={
                           'TensorAFormat': 'NCHW',
                           'Filter': '3x5',
                       })
    log.debug(conv.printUsage(z))
    assert (z['NumIndicesC'] == 4)
    assert (z['IndexAssignmentsA'] == [5, 0, 1, 2, 4])
    assert (z['IndexAssignmentsB'] == [5, 3, 4])
    #assert(z['SetConstStrideA']==[[3,1]])
    assert (z['SetConstStrideB'] == [])
    YamlBuilder.run_tensile_client(request, conv, z, tensile_client_dir,
                                   tmp_path)
コード例 #3
0
def test_nchw_backwardweights_defaults(request, tensile_client_dir, tmp_path):
    z = {}  # problemType definition
    conv = Convolution(z,
                       'ConvolutionBackwardWeights',
                       config={
                           'TensorAFormat': 'NCHW',
                           'Spatial': '14x14',
                       })
    log.debug(conv.printUsage(z))
    assert (z['NumIndicesC'] == 2)
    assert (z['IndexAssignmentsA'] == [3, 0, 2])
    assert (z['IndexAssignmentsB'] == [3, 1, 2])
    assert (z['SetConstStrideA'] == [[3, 1]])
    assert (z['SetConstStrideB'] == [])
    YamlBuilder.run_tensile_client(request, conv, z, tensile_client_dir,
                                   tmp_path)
コード例 #4
0
ファイル: test_yaml.py プロジェクト: zjunweihit/Tensile
def test_yaml(request, tensile_client_dir, tmp_path):
    z = {}  # problemType definition
    conv = Convolution(z,
                       'ConvolutionForward',
                       config={
                           'TensorAFormat': 'NCHW',
                       })
    log.debug(conv.printUsage(z))
    assert (z['NumIndicesC'] == 3)
    assert (z['IndexAssignmentsA'] == [0, 3, 2])
    assert (z['IndexAssignmentsB'] == [3, 1, 2])
    assert (z['SetConstStrideA'] == [[0, 1]])
    assert (z['SetConstStrideB'] == [[2, 0]])
    assert (z['UseInitialStrides'] == False)

    YamlBuilder.run_tensile_client(request, conv, z, tensile_client_dir,
                                   tmp_path)
コード例 #5
0
    def run(conv, problemType={}, solution=Solutions.src1, dataType='s'):
        config = YamlBuilder.ConvolutionVsContraction(conv, solution, dataType)
        configFile = file_with_test_name(".conv.yaml")
        config.write(configFile)

        args = [str(configFile), str(tmp_path), *tensile_args]

        subprocess.check_call([tensile_script_path] + args)
コード例 #6
0
ファイル: conftest.py プロジェクト: twhite-cray/Tensile
    def run(conv,
            problemType={},
            solution=Solutions.defaultSolution(),
            dataType='s'):
        config = YamlBuilder.ConvolutionVsContraction(conv, solution, dataType)
        configFile = file_with_test_name(".conv.yaml")
        config.write(configFile)

        Tensile.Tensile([str(configFile), str(tmp_path), *tensile_args])
コード例 #7
0
 def run(conv, problemType, solution=Solutions.defaultSolution(), problemFunc=None, problemLevel=-1, dataType='s'):
     if problemFunc == None:
         problemFunc = YamlBuilder.ProblemSizes
     if problemLevel==-1:
         problemLevel = request.config.getoption("--problem-level")
     config = YamlBuilder.ConvolutionContraction(conv, problemType, solution, dataType, problemFunc, True, problemLevel)
     configFile = file_with_test_name(".contraction.yaml")
     print("Generate_YAML output:", configFile)
     config.write(configFile)
     return configFile
コード例 #8
0
ファイル: test_problem_sizes.py プロジェクト: zaliu/Tensile
def test_3d(problem_level):
    "Test number of problems generated"
    z={} # problemType definition
    conv = Convolution(z, 'ConvolutionForward',
              config={'TensorAFormat': 'NCDHW',
                      'Stride': '2x2x2',
                      'Filter': '3x3x3',
                      })

    exacts = YamlBuilder.ProblemSizes(conv, z, problem_level)
    if exacts:
        None
コード例 #9
0
def test_filter_stride_dilation_0(request, tensile_client_dir, tmp_path):
    z = {}  # problemType definition
    conv = Convolution(z,
                       'ConvolutionForward',
                       config={
                           'TensorAFormat': 'NCHW',
                           'TensorBFormat': 'KCYX',
                           'TensorDFormat': 'NCHW',
                           'Filter': '2x3',
                           'Stride': '2x3',
                           'Dilation': '2x3',
                           'Spatial': '17x31',
                       })
    assert (z['NumIndicesC'] == 4)
    assert (z['IndexAssignmentsA'] == [6, 5, 0, 1, 4, 3])
    assert (z['IndexAssignmentsB'] == [6, 5, 4, 2, 3])
    assert (z['SetConstStrideA'] == [[0, 3], [6, 3]])
    assert (z['SetConstStrideB'] == [[3, 0]])
    assert (z['UseInitialStrides'] == True)
    log.debug(conv.printUsage(z))
    YamlBuilder.run_convolution_vs_contraction(request, conv, z,
                                               tensile_client_dir, tmp_path)
コード例 #10
0
ファイル: conftest.py プロジェクト: myrocm/Tensile
 def run(conv, problemType, dataType='s'):
     config = YamlBuilder.ConvolutionContraction(conv, problemType, dataType)
     configFile = file_with_test_name(".contraction.yaml")
     config.write(configFile)
     return configFile