xlabuilderparser

package
v0.28.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const GopjrtEnv = "GOPJRT_SRC"
View Source
const OpTypesFileName = "xlabuilder/op_types.txt"

Variables

View Source
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 = ""
)
View Source
var FunctionsBlackList = sets.MakeWith("Parameter", "ScalarZero", "ScalarOne", "PopulationCount")

Functions

func EnumerateFunctions

func EnumerateFunctions(pkg *ast.Package, callback func(funcDecl *ast.FuncDecl))

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 compute.Backend API, and implemented in the xla.Backend.

func GetGopjrt

func GetGopjrt() string

GetGopjrt returns GopjrtSourcePath if it is set, otherwise sets it to:

1. $GOPJRT_SRC, if it is set. 2. Download and return the source code into DefaultGopjrtSource.

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.

func (*NodeTextExtractor) Get

func (e *NodeTextExtractor) Get(node ast.Node) string

type OpInfo

type OpInfo struct {
	Name, Type string
}

OpInfo is the information collected from the `op_types.txt` file.

func ReadOpsInfo

func ReadOpsInfo() []OpInfo

ReadOpsInfo reads Gopjrt op_types.txt file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL