Lines Matching refs:ctx

31 static void registerAllUpstreamDialects(MlirContext ctx) {  in registerAllUpstreamDialects()  argument
34 mlirContextAppendDialectRegistry(ctx, registry); in registerAllUpstreamDialects()
38 void populateLoopBody(MlirContext ctx, MlirBlock loopBody, in populateLoopBody() argument
44 mlirTypeParseGet(ctx, mlirStringRefCreateFromCString("f32")); in populateLoopBody()
84 MlirModule makeAndDumpAdd(MlirContext ctx, MlirLocation location) { in makeAndDumpAdd() argument
89 mlirTypeParseGet(ctx, mlirStringRefCreateFromCString("memref<?xf32>")); in makeAndDumpAdd()
99 ctx, in makeAndDumpAdd()
102 mlirAttributeParseGet(ctx, mlirStringRefCreateFromCString("\"add\"")); in makeAndDumpAdd()
105 mlirIdentifierGet(ctx, in makeAndDumpAdd()
109 mlirIdentifierGet(ctx, mlirStringRefCreateFromCString("sym_name")), in makeAndDumpAdd()
119 mlirTypeParseGet(ctx, mlirStringRefCreateFromCString("index")); in makeAndDumpAdd()
121 mlirAttributeParseGet(ctx, mlirStringRefCreateFromCString("0 : index")); in makeAndDumpAdd()
123 mlirIdentifierGet(ctx, mlirStringRefCreateFromCString("value")), in makeAndDumpAdd()
148 mlirAttributeParseGet(ctx, mlirStringRefCreateFromCString("1 : index")); in makeAndDumpAdd()
150 mlirIdentifierGet(ctx, mlirStringRefCreateFromCString("value")), in makeAndDumpAdd()
169 populateLoopBody(ctx, loopBody, location, funcBody); in makeAndDumpAdd()
327 static void printFirstOfEach(MlirContext ctx, MlirOperation operation) { in printFirstOfEach() argument
387 MlirIdentifier identAgain = mlirIdentifierGet(ctx, identStr); in printFirstOfEach()
438 mlirBoolAttrGet(ctx, 1)); in printFirstOfEach()
464 mlirRankedTensorTypeGet(1, eltsShape, mlirIntegerTypeGet(ctx, 32), in printFirstOfEach()
482 static int constructAndTraverseIr(MlirContext ctx) { in constructAndTraverseIr() argument
483 MlirLocation location = mlirLocationUnknownGet(ctx); in constructAndTraverseIr()
485 MlirModule moduleOp = makeAndDumpAdd(ctx, location); in constructAndTraverseIr()
493 printFirstOfEach(ctx, module); in constructAndTraverseIr()
502 static void buildWithInsertionsAndPrint(MlirContext ctx) { in buildWithInsertionsAndPrint() argument
503 MlirLocation loc = mlirLocationUnknownGet(ctx); in buildWithInsertionsAndPrint()
504 mlirContextSetAllowUnregisteredDialects(ctx, true); in buildWithInsertionsAndPrint()
516 MlirType i1 = mlirIntegerTypeGet(ctx, 1); in buildWithInsertionsAndPrint()
517 MlirType i2 = mlirIntegerTypeGet(ctx, 2); in buildWithInsertionsAndPrint()
518 MlirType i3 = mlirIntegerTypeGet(ctx, 3); in buildWithInsertionsAndPrint()
519 MlirType i4 = mlirIntegerTypeGet(ctx, 4); in buildWithInsertionsAndPrint()
520 MlirType i5 = mlirIntegerTypeGet(ctx, 5); in buildWithInsertionsAndPrint()
579 mlirContextSetAllowUnregisteredDialects(ctx, false); in buildWithInsertionsAndPrint()
599 static int createOperationWithTypeInference(MlirContext ctx) { in createOperationWithTypeInference() argument
600 MlirLocation loc = mlirLocationUnknownGet(ctx); in createOperationWithTypeInference()
601 MlirAttribute iAttr = mlirIntegerAttrGet(mlirIntegerTypeGet(ctx, 32), 4); in createOperationWithTypeInference()
608 mlirIdentifierGet(ctx, mlirStringRefCreateFromCString("value")), iAttr); in createOperationWithTypeInference()
632 static int printBuiltinTypes(MlirContext ctx) { in printBuiltinTypes() argument
634 MlirType i32 = mlirIntegerTypeGet(ctx, 32); in printBuiltinTypes()
635 MlirType si32 = mlirIntegerTypeSignedGet(ctx, 32); in printBuiltinTypes()
636 MlirType ui32 = mlirIntegerTypeUnsignedGet(ctx, 32); in printBuiltinTypes()
660 MlirType index = mlirIndexTypeGet(ctx); in printBuiltinTypes()
668 MlirType bf16 = mlirBF16TypeGet(ctx); in printBuiltinTypes()
669 MlirType f16 = mlirF16TypeGet(ctx); in printBuiltinTypes()
670 MlirType f32 = mlirF32TypeGet(ctx); in printBuiltinTypes()
671 MlirType f64 = mlirF64TypeGet(ctx); in printBuiltinTypes()
694 MlirType none = mlirNoneTypeGet(ctx); in printBuiltinTypes()
751 MlirAttribute memSpace2 = mlirIntegerAttrGet(mlirIntegerTypeGet(ctx, 64), 2); in printBuiltinTypes()
762 MlirAttribute memSpace4 = mlirIntegerAttrGet(mlirIntegerTypeGet(ctx, 64), 4); in printBuiltinTypes()
775 MlirType tuple = mlirTupleTypeGet(ctx, 2, types); in printBuiltinTypes()
785 MlirType funcInputs[2] = {mlirIndexTypeGet(ctx), mlirIntegerTypeGet(ctx, 1)}; in printBuiltinTypes()
786 MlirType funcResults[3] = {mlirIntegerTypeGet(ctx, 16), in printBuiltinTypes()
787 mlirIntegerTypeGet(ctx, 32), in printBuiltinTypes()
788 mlirIntegerTypeGet(ctx, 64)}; in printBuiltinTypes()
789 MlirType funcType = mlirFunctionTypeGet(ctx, 2, funcInputs, 3, funcResults); in printBuiltinTypes()
808 mlirContextSetAllowUnregisteredDialects(ctx, true); in printBuiltinTypes()
809 MlirType opaque = mlirOpaqueTypeGet(ctx, namespace, data); in printBuiltinTypes()
810 mlirContextSetAllowUnregisteredDialects(ctx, false); in printBuiltinTypes()
835 int printBuiltinAttributes(MlirContext ctx) { in printBuiltinAttributes() argument
837 mlirFloatAttrDoubleGet(ctx, mlirF64TypeGet(ctx), 2.0); in printBuiltinAttributes()
851 MlirAttribute integer = mlirIntegerAttrGet(mlirIntegerTypeGet(ctx, 32), 42); in printBuiltinAttributes()
853 mlirIntegerAttrGet(mlirIntegerTypeSignedGet(ctx, 8), -1); in printBuiltinAttributes()
855 mlirIntegerAttrGet(mlirIntegerTypeUnsignedGet(ctx, 8), 255); in printBuiltinAttributes()
868 MlirAttribute boolean = mlirBoolAttrGet(ctx, 1); in printBuiltinAttributes()
876 mlirOpaqueAttrGet(ctx, mlirStringRefCreateFromCString("func"), 3, data, in printBuiltinAttributes()
877 mlirNoneTypeGet(ctx)); in printBuiltinAttributes()
890 mlirStringAttrGet(ctx, mlirStringRefCreate(data + 3, 2)); in printBuiltinAttributes()
902 mlirFlatSymbolRefAttrGet(ctx, mlirStringRefCreate(data + 5, 3)); in printBuiltinAttributes()
916 mlirSymbolRefAttrGet(ctx, mlirStringRefCreate(data + 8, 2), 2, symbols); in printBuiltinAttributes()
935 MlirAttribute type = mlirTypeAttrGet(mlirF32TypeGet(ctx)); in printBuiltinAttributes()
937 !mlirTypeEqual(mlirF32TypeGet(ctx), mlirTypeAttrGetValue(type))) in printBuiltinAttributes()
942 MlirAttribute unit = mlirUnitAttrGet(ctx); in printBuiltinAttributes()
965 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeGet(ctx, 1), encoding), in printBuiltinAttributes()
968 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeUnsignedGet(ctx, 8), in printBuiltinAttributes()
972 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeGet(ctx, 8), encoding), in printBuiltinAttributes()
975 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeUnsignedGet(ctx, 16), in printBuiltinAttributes()
979 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeGet(ctx, 16), encoding), in printBuiltinAttributes()
982 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeUnsignedGet(ctx, 32), in printBuiltinAttributes()
986 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeGet(ctx, 32), encoding), in printBuiltinAttributes()
989 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeUnsignedGet(ctx, 64), in printBuiltinAttributes()
993 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeGet(ctx, 64), encoding), in printBuiltinAttributes()
996 mlirRankedTensorTypeGet(2, shape, mlirF32TypeGet(ctx), encoding), 2, in printBuiltinAttributes()
999 mlirRankedTensorTypeGet(2, shape, mlirF64TypeGet(ctx), encoding), 2, in printBuiltinAttributes()
1002 mlirRankedTensorTypeGet(2, shape, mlirBF16TypeGet(ctx), encoding), 2, in printBuiltinAttributes()
1005 mlirRankedTensorTypeGet(2, shape, mlirF16TypeGet(ctx), encoding), 2, in printBuiltinAttributes()
1059 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeGet(ctx, 1), encoding), in printBuiltinAttributes()
1062 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeUnsignedGet(ctx, 8), in printBuiltinAttributes()
1066 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeGet(ctx, 8), encoding), in printBuiltinAttributes()
1069 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeUnsignedGet(ctx, 32), in printBuiltinAttributes()
1073 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeGet(ctx, 32), encoding), in printBuiltinAttributes()
1076 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeUnsignedGet(ctx, 64), in printBuiltinAttributes()
1080 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeGet(ctx, 64), encoding), in printBuiltinAttributes()
1083 mlirRankedTensorTypeGet(2, shape, mlirF32TypeGet(ctx), encoding), 1.0f); in printBuiltinAttributes()
1085 mlirRankedTensorTypeGet(2, shape, mlirF64TypeGet(ctx), encoding), 1.0); in printBuiltinAttributes()
1178 mlirRankedTensorTypeGet(2, shape, mlirIntegerTypeGet(ctx, 64), encoding), in printBuiltinAttributes()
1181 mlirRankedTensorTypeGet(1, &one, mlirF32TypeGet(ctx), encoding), 1, in printBuiltinAttributes()
1184 mlirRankedTensorTypeGet(2, shape, mlirF32TypeGet(ctx), encoding), in printBuiltinAttributes()
1192 int printAffineMap(MlirContext ctx) { in printAffineMap() argument
1193 MlirAffineMap emptyAffineMap = mlirAffineMapEmptyGet(ctx); in printAffineMap()
1194 MlirAffineMap affineMap = mlirAffineMapZeroResultGet(ctx, 3, 2); in printAffineMap()
1195 MlirAffineMap constAffineMap = mlirAffineMapConstantGet(ctx, 2); in printAffineMap()
1197 mlirAffineMapMultiDimIdentityGet(ctx, 3); in printAffineMap()
1199 mlirAffineMapMinorIdentityGet(ctx, 3, 2); in printAffineMap()
1202 ctx, sizeof(permutation) / sizeof(unsigned), permutation); in printAffineMap()
1317 int printAffineExpr(MlirContext ctx) { in printAffineExpr() argument
1318 MlirAffineExpr affineDimExpr = mlirAffineDimExprGet(ctx, 5); in printAffineExpr()
1319 MlirAffineExpr affineSymbolExpr = mlirAffineSymbolExprGet(ctx, 5); in printAffineExpr()
1320 MlirAffineExpr affineConstantExpr = mlirAffineConstantExprGet(ctx, 5); in printAffineExpr()
1452 MlirAffineExpr otherDimExpr = mlirAffineDimExprGet(ctx, 5); in printAffineExpr()
1462 int affineMapFromExprs(MlirContext ctx) { in affineMapFromExprs() argument
1463 MlirAffineExpr affineDimExpr = mlirAffineDimExprGet(ctx, 0); in affineMapFromExprs()
1464 MlirAffineExpr affineSymbolExpr = mlirAffineSymbolExprGet(ctx, 1); in affineMapFromExprs()
1466 MlirAffineMap map = mlirAffineMapGet(ctx, 3, 3, 2, exprs); in affineMapFromExprs()
1482 MlirAffineExpr affineDim2Expr = mlirAffineDimExprGet(ctx, 1); in affineMapFromExprs()
1492 int printIntegerSet(MlirContext ctx) { in printIntegerSet() argument
1493 MlirIntegerSet emptySet = mlirIntegerSetEmptyGet(ctx, 2, 1); in printIntegerSet()
1504 MlirIntegerSet anotherEmptySet = mlirIntegerSetEmptyGet(ctx, 2, 1); in printIntegerSet()
1511 MlirAffineExpr negOne = mlirAffineConstantExprGet(ctx, -1); in printIntegerSet()
1512 MlirAffineExpr negFortyTwo = mlirAffineConstantExprGet(ctx, -42); in printIntegerSet()
1513 MlirAffineExpr d0 = mlirAffineDimExprGet(ctx, 0); in printIntegerSet()
1514 MlirAffineExpr d1 = mlirAffineDimExprGet(ctx, 1); in printIntegerSet()
1515 MlirAffineExpr s0 = mlirAffineSymbolExprGet(ctx, 0); in printIntegerSet()
1522 MlirIntegerSet set = mlirIntegerSetGet(ctx, 2, 1, 2, constraints, flags); in printIntegerSet()
1529 MlirAffineExpr s1 = mlirAffineSymbolExprGet(ctx, 1); in printIntegerSet()
1572 MlirContext ctx = mlirContextCreate(); in registerOnlyStd() local
1574 if (mlirContextGetNumLoadedDialects(ctx) != 1) in registerOnlyStd()
1580 ctx, mlirDialectHandleGetNamespace(stdHandle)); in registerOnlyStd()
1584 mlirDialectHandleRegisterDialect(stdHandle, ctx); in registerOnlyStd()
1586 std = mlirContextGetOrLoadDialect(ctx, in registerOnlyStd()
1591 MlirDialect alsoStd = mlirDialectHandleLoadDialect(stdHandle, ctx); in registerOnlyStd()
1607 ctx, mlirStringRefCreateFromCString("cf.cond_br"))); in registerOnlyStd()
1612 ctx, mlirStringRefCreateFromCString("func.not_existing_op"))); in registerOnlyStd()
1617 ctx, mlirStringRefCreateFromCString( in registerOnlyStd()
1620 mlirContextDestroy(ctx); in registerOnlyStd()
1628 MlirContext ctx = mlirContextCreate(); in testBackreferences() local
1629 mlirContextSetAllowUnregisteredDialects(ctx, true); in testBackreferences()
1630 MlirLocation loc = mlirLocationUnknownGet(ctx); in testBackreferences()
1640 mlirIdentifierGet(ctx, mlirStringRefCreateFromCString("identifier")); in testBackreferences()
1642 if (!mlirContextEqual(ctx, mlirOperationGetContext(op))) { in testBackreferences()
1650 if (!mlirContextEqual(ctx, mlirIdentifierGetContext(ident))) { in testBackreferences()
1656 mlirContextDestroy(ctx); in testBackreferences()
1667 MlirContext ctx = mlirContextCreate(); in testOperands() local
1668 registerAllUpstreamDialects(ctx); in testOperands()
1670 mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("arith")); in testOperands()
1671 mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("test")); in testOperands()
1672 MlirLocation loc = mlirLocationUnknownGet(ctx); in testOperands()
1673 MlirType indexType = mlirIndexTypeGet(ctx); in testOperands()
1677 mlirAttributeParseGet(ctx, mlirStringRefCreateFromCString("0 : index")); in testOperands()
1679 mlirIdentifierGet(ctx, mlirStringRefCreateFromCString("value")), in testOperands()
1689 mlirAttributeParseGet(ctx, mlirStringRefCreateFromCString("1 : index")); in testOperands()
1691 mlirIdentifierGet(ctx, mlirStringRefCreateFromCString("value")), in testOperands()
1701 mlirContextSetAllowUnregisteredDialects(ctx, true); in testOperands()
1727 mlirContextDestroy(ctx); in testOperands()
1737 MlirContext ctx = mlirContextCreate(); in testClone() local
1738 registerAllUpstreamDialects(ctx); in testClone()
1740 mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("func")); in testClone()
1741 MlirLocation loc = mlirLocationUnknownGet(ctx); in testClone()
1742 MlirType indexType = mlirIndexTypeGet(ctx); in testClone()
1746 mlirAttributeParseGet(ctx, mlirStringRefCreateFromCString("0 : index")); in testClone()
1748 mlirIdentifierGet(ctx, valueStringRef), indexZeroLiteral); in testClone()
1756 mlirAttributeParseGet(ctx, mlirStringRefCreateFromCString("1 : index")); in testClone()
1767 mlirContextDestroy(ctx); in testClone()
1791 int testTypeID(MlirContext ctx) { in testTypeID() argument
1795 MlirType i32 = mlirIntegerTypeGet(ctx, 32); in testTypeID()
1797 MlirType ui32 = mlirIntegerTypeUnsignedGet(ctx, 32); in testTypeID()
1799 MlirType f32 = mlirF32TypeGet(ctx); in testTypeID()
1830 MlirLocation loc = mlirLocationUnknownGet(ctx); in testTypeID()
1831 MlirType indexType = mlirIndexTypeGet(ctx); in testTypeID()
1836 mlirAttributeParseGet(ctx, mlirStringRefCreateFromCString("0 : index")); in testTypeID()
1838 mlirIdentifierGet(ctx, valueStringRef), indexZeroLiteral); in testTypeID()
1864 mlirContextSetAllowUnregisteredDialects(ctx, true); in testTypeID()
1887 int testSymbolTable(MlirContext ctx) { in testSymbolTable() argument
1896 mlirModuleCreateParse(ctx, mlirStringRefCreateFromCString(moduleString)); in testSymbolTable()
1898 ctx, mlirStringRefCreateFromCString(otherModuleString)); in testSymbolTable()
1990 MlirContext ctx = mlirContextCreate(); in testDialectRegistry() local
1991 if (mlirContextGetNumRegisteredDialects(ctx) != 0) { in testDialectRegistry()
1996 mlirContextAppendDialectRegistry(ctx, registry); in testDialectRegistry()
1997 if (mlirContextGetNumRegisteredDialects(ctx) != 1) { in testDialectRegistry()
2002 mlirContextDestroy(ctx); in testDialectRegistry()
2009 MlirContext ctx = mlirContextCreate(); in testDiagnostics() local
2011 ctx, errorHandler, (void *)42, deleteUserData); in testDiagnostics()
2013 MlirLocation unknownLoc = mlirLocationUnknownGet(ctx); in testDiagnostics()
2016 ctx, mlirStringRefCreateFromCString("file.c"), 1, 2); in testDiagnostics()
2020 ctx, mlirStringRefCreateFromCString("other-file.c"), 2, 3), in testDiagnostics()
2025 mlirLocationNameGet(ctx, mlirStringRefCreateFromCString("named"), null); in testDiagnostics()
2029 MlirLocation fusedLoc = mlirLocationFusedGet(ctx, 2, locs, nullAttr); in testDiagnostics()
2031 mlirContextDetachDiagnosticHandler(ctx, id); in testDiagnostics()
2056 mlirContextDestroy(ctx); in testDiagnostics()
2060 MlirContext ctx = mlirContextCreate(); in main() local
2061 registerAllUpstreamDialects(ctx); in main()
2062 mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("func")); in main()
2063 mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("memref")); in main()
2064 mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("shape")); in main()
2065 mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("scf")); in main()
2067 if (constructAndTraverseIr(ctx)) in main()
2069 buildWithInsertionsAndPrint(ctx); in main()
2070 if (createOperationWithTypeInference(ctx)) in main()
2073 if (printBuiltinTypes(ctx)) in main()
2075 if (printBuiltinAttributes(ctx)) in main()
2077 if (printAffineMap(ctx)) in main()
2079 if (printAffineExpr(ctx)) in main()
2081 if (affineMapFromExprs(ctx)) in main()
2083 if (printIntegerSet(ctx)) in main()
2093 if (testTypeID(ctx)) in main()
2095 if (testSymbolTable(ctx)) in main()
2100 mlirContextDestroy(ctx); in main()