Documentation
¶
Overview ¶
Package xlabuilderparser parses the xlabuilder API to enumerate graph building functions, and the `op_types.txt` file to get a list of the supported ops.
It will clone a temporary copy of gopjrt (github.com/gomlx/gopjrt) repository by default, or use the one under GOPJRT_SRC if it is set.
Index ¶
Constants ¶
const GopjrtEnv = "GOPJRT_SRC"
const OpTypesFileName = "xlabuilder/op_types.txt"
Variables ¶
var ( // DefaultGopjrtSource is the directory where to clone the gopjrt (github.com/gomlx/gopjrt) source code. // If not an absolute directory, it will be prefixed by os.TempDir(). DefaultGopjrtSource = "xlabuilderparser" // GopjrtSourcePath is the cached path used for the source code. GopjrtSourcePath = "" )
var FunctionsBlackList = sets.MakeWith("Parameter", "ScalarZero", "ScalarOne", "PopulationCount")
Functions ¶
func EnumerateFunctions ¶
EnumerateFunctions calls callback for every function declaration in the package. Presumably to be used with the return value of Parse.
func EnumerateStandardOpsFunctions ¶
func EnumerateStandardOpsFunctions(extractor *NodeTextExtractor, xlaBuilderPkg *ast.Package, callback func(funcDecl *ast.FuncDecl))
EnumerateStandardOpsFunctions calls callback for every "standard" op declaring function of the xlaBuilder package AST, that can be automatically converted to a backends.Backend API, and implemented in the xla.Backend.
Types ¶
type NodeTextExtractor ¶
type NodeTextExtractor struct {
// contains filtered or unexported fields
}
func NewNodeTextExtractor ¶
func NewNodeTextExtractor(fset *token.FileSet) *NodeTextExtractor
func Parse ¶
func Parse() (*NodeTextExtractor, *ast.Package)
Parse returns the parse tree of the gopjrt/xlabuilder pacakge.
Notice ast.Package is deprecated, but the go/types package it suggests as a replacement doesn't seem to do the same thing.