basic_go_gx

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package basic_go_gx are Go bindings to the GX package: github.com/gx-org/gx/tests/bindings/basic.

Automatically generated by gx/golang/binder/gobindings/bindings.go.tmpl.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddPrivate

type AddPrivate struct {
	// contains filtered or unexported fields
}

AddPrivate compiles and runs the GX function AddPrivate for a device. AddPrivate returns the sum of two private fields.

func (*AddPrivate) Run

func (f *AddPrivate) Run(arg0 *Basic) (_ types.Atom[int32], err error)

Run first compiles AddPrivate for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*AddPrivate) String

func (f *AddPrivate) String() string

type Basic

type Basic struct {
	Int types.Atom[int32]

	Float types.Atom[float32]

	Array types.Array[float32]
	// contains filtered or unexported fields
}

Basic stores the handle of Basic on a device.

func (Basic) AddPrivate

func (s Basic) AddPrivate() *MethodBasicAddPrivate

AddPrivate returns a handle to compile method AddPrivate for a device.

func (*Basic) Bridge

func (s *Basic) Bridge() types.Bridge

Bridge returns the bridge between the Go value and the GX value.

func (Basic) SetFloat

func (s Basic) SetFloat() *MethodBasicSetFloat

SetFloat returns a handle to compile method SetFloat for a device.

func (Basic) String

func (s Basic) String() string

type Empty

type Empty struct {
	// contains filtered or unexported fields
}

Empty stores the handle of Empty on a device.

func (*Empty) Bridge

func (s *Empty) Bridge() types.Bridge

Bridge returns the bridge between the Go value and the GX value.

func (Empty) String

func (s Empty) String() string

type Factory

type Factory struct {
	Package *Package
}

Factory create new instance of types used in the package. The compiler associated with the factory defines on what device and with which options methods of the instances created by the factory are compiled for.

func (*Factory) NewBasic

func (fac *Factory) NewBasic() *Basic

NewBasic returns a handle on named type Basic.

func (*Factory) NewEmpty

func (fac *Factory) NewEmpty() *Empty

NewEmpty returns a handle on named type Empty.

type MethodBasicAddPrivate

type MethodBasicAddPrivate struct {
	// contains filtered or unexported fields
}

MethodBasicAddPrivate compiles and runs the GX function AddPrivate for a device. AddPrivate returns the sum of two private fields.

func (*MethodBasicAddPrivate) Run

func (f *MethodBasicAddPrivate) Run() (_ types.Atom[int32], err error)

Run first compiles AddPrivate for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodBasicAddPrivate) String

func (f *MethodBasicAddPrivate) String() string

type MethodBasicSetFloat

type MethodBasicSetFloat struct {
	// contains filtered or unexported fields
}

MethodBasicSetFloat compiles and runs the GX function SetFloat for a device. SetFloat sets the Float field.

func (*MethodBasicSetFloat) Run

func (f *MethodBasicSetFloat) Run(arg0 types.Atom[float32]) (_ *Basic, err error)

Run first compiles SetFloat for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodBasicSetFloat) String

func (f *MethodBasicSetFloat) String() string

type New

type New struct {
	// contains filtered or unexported fields
}

New compiles and runs the GX function New for a device. New returns a new instance of the basic structure.

func (*New) Run

func (f *New) Run() (_ *Basic, err error)

Run first compiles New for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*New) String

func (f *New) String() string

type Package

type Package struct {
	Package *PackageIR
	Device  *api.Device
	Factory *Factory

	ReturnFloat32      ReturnFloat32
	ReturnArrayFloat32 ReturnArrayFloat32
	ReturnMultiple     ReturnMultiple
	New                New
	AddPrivate         AddPrivate
	// contains filtered or unexported fields
}

Package is a GX package for a given device. Functions and methods are compiled specifically for that device.

func BuildFor

func BuildFor(dev *api.Device, options ...options.PackageOptionFactory) (*Package, error)

BuildFor loads the GX package github.com/gx-org/gx/tests/bindings/basic then returns that package for a given device and options.

func (*Package) AppendOptions

func (cmpl *Package) AppendOptions(options ...options.PackageOptionFactory)

AppendOptions appends options to the compiler.

func (*Package) MarshalBasic

func (cmpl *Package) MarshalBasic(val values.Value) (s *Basic, err error)

MarshalBasic populates the receiver fields with device handles.

func (*Package) MarshalEmpty

func (cmpl *Package) MarshalEmpty(val values.Value) (s *Empty, err error)

MarshalEmpty populates the receiver fields with device handles.

type PackageIR

type PackageIR struct {
	Runtime *api.Runtime
	IR      *ir.Package
	Tracer  trace.Callback
}

PackageIR is the GX package intermediate representation built for a given runtime, but not yet for a specific device.

func Load

func Load(rtm *api.Runtime) (*PackageIR, error)

Load the GX package for a given backend.

func (*PackageIR) BuildFor

func (pkg *PackageIR) BuildFor(dev *api.Device, options ...options.PackageOptionFactory) *Package

BuildFor returns a package ready to compile for a device and options.

type ReturnArrayFloat32

type ReturnArrayFloat32 struct {
	// contains filtered or unexported fields
}

ReturnArrayFloat32 compiles and runs the GX function ReturnArrayFloat32 for a device. ReturnArrayFloat32 returns a float32 tensor.

func (*ReturnArrayFloat32) Run

func (f *ReturnArrayFloat32) Run() (_ types.Array[float32], err error)

Run first compiles ReturnArrayFloat32 for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*ReturnArrayFloat32) String

func (f *ReturnArrayFloat32) String() string

type ReturnFloat32

type ReturnFloat32 struct {
	// contains filtered or unexported fields
}

ReturnFloat32 compiles and runs the GX function ReturnFloat32 for a device. ReturnFloat32 returns a float32.

func (*ReturnFloat32) Run

func (f *ReturnFloat32) Run() (_ types.Atom[float32], err error)

Run first compiles ReturnFloat32 for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*ReturnFloat32) String

func (f *ReturnFloat32) String() string

type ReturnMultiple

type ReturnMultiple struct {
	// contains filtered or unexported fields
}

ReturnMultiple compiles and runs the GX function ReturnMultiple for a device. ReturnMultiple returns multiple values.

func (*ReturnMultiple) Run

func (f *ReturnMultiple) Run() (_ types.Atom[int32], _ types.Atom[float32], _ types.Atom[float64], err error)

Run first compiles ReturnMultiple for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*ReturnMultiple) String

func (f *ReturnMultiple) String() string

Jump to

Keyboard shortcuts

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