def f16_hpa_ldl(): return { 'kernel': { "ProblemType": { "DataType": DataType(DataType.half), "HighPrecisionAccumulate": True }, "AggressivePerfMode": True, "LocalDotLayout": 2, "InnerUnroll": 2, "ThreadTile0": 4, "ThreadTile1": 4 } }
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()
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()
def test_init_i8(): expected = DataType('4xi8') assert DataType('int8x4') == expected assert DataType('Int8x4') == expected assert DataType('tensileDataTypeInt8x4') == expected
def test_init_i32(): expected = DataType('I') assert DataType('int32') == expected assert DataType('Int32') == expected assert DataType('tensileDataTypeInt32') == expected
def test_init_complexDouble(): expected = DataType('Z') assert DataType('complexDouble') == expected assert DataType('complexDouble') == expected assert DataType('tensileDataTypeComplexDouble') == expected
def test_init_half(): expected = DataType('H') assert DataType('half') == expected assert DataType('Half') == expected assert DataType('tensileDataTypeHalf') == expected
def test_init_double(): expected = DataType('D') assert DataType('double') == expected assert DataType('Double') == expected assert DataType('tensileDataTypeDouble') == expected
def test_init_complexSingle(): expected = DataType('C') assert DataType('complexSingle') == expected assert DataType('complexFloat') == expected assert DataType('tensileDataTypeComplexFloat') == expected
def test_bounds(): with pytest.raises(Exception): DataType(10)
def test_init_single(): expected = DataType('S') assert DataType('single') == expected assert DataType('Float') == expected assert DataType('tensileDataTypeFloat') == expected
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')
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()
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()
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()
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()