1
0
mirror of https://github.com/fumiama/gozel.git synced 2026-06-12 12:30:33 +08:00

feat(example): impl. vadd

This commit is contained in:
源文雨
2026-03-25 00:25:24 +08:00
parent 1111b0ecc1
commit 25cb3b9741
16 changed files with 531 additions and 24 deletions

21
ze/context.go Normal file
View File

@@ -0,0 +1,21 @@
package ze
import "github.com/fumiama/gozel"
// ContextHandle is a handle to a Level Zero context.
type ContextHandle gozel.ZeContextHandle
// ContextCreate creates a new context for the driver.
func (h DriverHandle) ContextCreate() (ContextHandle, error) {
var ctx gozel.ZeContextHandle
_, err := gozel.ZeContextCreate(gozel.ZeDriverHandle(h), &gozel.ZeContextDesc{
Stype: gozel.ZE_STRUCTURE_TYPE_CONTEXT_DESC,
}, &ctx)
return ContextHandle(ctx), err
}
// Destroy destroys the context and releases its resources.
func (h ContextHandle) Destroy() error {
_, err := gozel.ZeContextDestroy(gozel.ZeContextHandle(h))
return err
}