Exemplo n.º 1
0
def f16_hpa_ldl():
    return {
        'kernel': {
            "ProblemType": {
                "DataType": DataType(DataType.half),
                "HighPrecisionAccumulate": True
            },
            "AggressivePerfMode": True,
            "LocalDotLayout": 2,
            "InnerUnroll": 2,
            "ThreadTile0": 4,
            "ThreadTile1": 4
        }
    }
Exemplo n.º 2
0
def test_single():
    obj = DataType(0)
    assert obj.toChar() == 'S'
    assert obj.toName() == 'single'
    assert obj.toEnum() == 'Float'
    assert obj.toOpenCL() == 'float'
    assert obj.toHIP() == 'float'
    assert obj.toDevice("") == 'float'
    assert obj.toCpp() == 'float'
    assert obj.getLibString() == 'tensileDataTypeFloat'
    assert obj.numBytes() == 4
    assert obj.isReal()
Exemplo n.º 3
0
def test_double():
    obj = DataType(1)
    assert obj.toChar() == 'D'
    assert obj.toName() == 'double'
    assert obj.toEnum() == 'Double'
    assert obj.toOpenCL() == 'double'
    assert obj.toHIP() == 'double'
    assert obj.toDevice("") == 'double'
    assert obj.toCpp() == 'double'
    assert obj.getLibString() == 'tensileDataTypeDouble'
    assert obj.numBytes() == 8
    assert obj.isReal()
Exemplo n.º 4
0
def test_init_i8():
    expected = DataType('4xi8')
    assert DataType('int8x4') == expected
    assert DataType('Int8x4') == expected
    assert DataType('tensileDataTypeInt8x4') == expected
Exemplo n.º 5
0
def test_init_i32():
    expected = DataType('I')
    assert DataType('int32') == expected
    assert DataType('Int32') == expected
    assert DataType('tensileDataTypeInt32') == expected
Exemplo n.º 6
0
def test_init_complexDouble():
    expected = DataType('Z')
    assert DataType('complexDouble') == expected
    assert DataType('complexDouble') == expected
    assert DataType('tensileDataTypeComplexDouble') == expected
Exemplo n.º 7
0
def test_init_half():
    expected = DataType('H')
    assert DataType('half') == expected
    assert DataType('Half') == expected
    assert DataType('tensileDataTypeHalf') == expected
Exemplo n.º 8
0
def test_init_double():
    expected = DataType('D')
    assert DataType('double') == expected
    assert DataType('Double') == expected
    assert DataType('tensileDataTypeDouble') == expected
Exemplo n.º 9
0
def test_init_complexSingle():
    expected = DataType('C')
    assert DataType('complexSingle') == expected
    assert DataType('complexFloat') == expected
    assert DataType('tensileDataTypeComplexFloat') == expected
Exemplo n.º 10
0
def test_bounds():
    with pytest.raises(Exception):
        DataType(10)
Exemplo n.º 11
0
def test_init_single():
    expected = DataType('S')
    assert DataType('single') == expected
    assert DataType('Float') == expected
    assert DataType('tensileDataTypeFloat') == expected
Exemplo n.º 12
0
def test_cmp():
    assert DataType('single') == DataType('S')
    assert not DataType('S') != DataType(0)
    assert DataType('Float') < DataType('Double')
    assert not DataType('tensileDataTypeFloat') > DataType('Z')
    assert DataType('half') >= DataType('ComplexFloat')
    assert not DataType('int32') <= DataType('tensileDataTypeInt8x4')
Exemplo n.º 13
0
def test_int32():
    obj = DataType(6)
    assert obj.toChar() == 'I'
    assert obj.toName() == 'int32'
    assert obj.toEnum() == 'Int32'
    assert obj.toOpenCL() == 'ERROR'
    assert obj.toHIP() == 'int32_t'
    assert obj.toDevice("OCL") == 'ERROR'
    assert obj.toDevice("") == 'int32_t'
    assert obj.toCpp() == 'TensileInt32'
    assert obj.getLibString() == 'tensileDataTypeInt32'
    assert obj.numBytes() == 4
    assert obj.isReal()
Exemplo n.º 14
0
def test_half():
    obj = DataType(4)
    assert obj.toChar() == 'H'
    assert obj.toName() == 'half'
    assert obj.toEnum() == 'Half'
    assert obj.toOpenCL() == 'ERROR'
    assert obj.toHIP() == 'tensile_half'
    assert obj.toDevice("OCL") == 'ERROR'
    assert obj.toDevice("") == 'tensile_half'
    assert obj.toCpp() == 'TensileHalf'
    assert obj.getLibString() == 'tensileDataTypeHalf'
    assert obj.numBytes() == 2
    assert obj.isReal()
Exemplo n.º 15
0
def test_complexDouble():
    obj = DataType(3)
    assert obj.toChar() == 'Z'
    assert obj.toName() == 'complexDouble'
    assert obj.toEnum() == 'ComplexDouble'
    assert obj.toOpenCL() == 'double2'
    assert obj.toHIP() == 'TensileComplexDouble'
    assert obj.toDevice("") == 'TensileComplexDouble'
    assert obj.toCpp() == 'TensileComplexDouble'
    assert obj.getLibString() == 'tensileDataTypeComplexDouble'
    assert obj.numBytes() == 16
    assert not obj.isReal()
Exemplo n.º 16
0
def test_complexSingle():
    obj = DataType(2)
    assert obj.toChar() == 'C'
    assert obj.toName() == 'complexSingle'
    assert obj.toEnum() == 'ComplexFloat'
    assert obj.toOpenCL() == 'float2'
    assert obj.toHIP() == 'TensileComplexFloat'
    assert obj.toDevice("") == 'TensileComplexFloat'
    assert obj.toCpp() == 'TensileComplexFloat'
    assert obj.getLibString() == 'tensileDataTypeComplexFloat'
    assert obj.numBytes() == 8
    assert not obj.isReal()