1
0
mirror of https://github.com/fumiama/gozel.git synced 2026-06-05 00:10:24 +08:00

feat: add all other needs

This commit is contained in:
源文雨
2026-03-25 23:25:56 +08:00
parent 32ada81b80
commit 64de25bd44
28 changed files with 4678 additions and 416 deletions

145
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,145 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
pull-requests: write
jobs:
gofmt:
name: Check gofmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run gofmt
run: gofmt -w .
- name: Check for changes
id: diff
run: |
if [ -n "$(git diff --name-only)" ]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Create Pull Request
if: steps.diff.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: run gofmt"
title: "chore: run gofmt"
body: |
Automated PR created by CI.
`gofmt -w .` detected formatting differences and applied fixes.
branch: auto/gofmt
delete-branch: true
go-generate:
name: Check go generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download SYCL Linux
run: |
wget https://github.com/intel/llvm/releases/download/v6.3.0/sycl_linux.tar.gz
tar -xzf sycl_linux.tar.gz
- name: Add SYCL bin to PATH
run: |
echo "${{ github.workspace }}/sycl_linux/bin" >> $GITHUB_PATH
- name: Run go generate
run: go generate ./...
- name: Check for changes
id: diff
run: |
if [ -n "$(git diff --name-only)" ]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Create Pull Request
if: steps.diff.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: run go generate"
title: "chore: run go generate"
body: |
Automated PR created by CI.
`go generate .` detected generated file differences and applied updates.
branch: auto/go-generate
delete-branch: true
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
go-version: ["stable"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Build all packages
run: go build ./...
- name: Build cmd/gen
run: go build ./cmd/gen
- name: Build cmd/func2kernel
run: go build ./cmd/func2kernel
test:
name: Test
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
go-version: ["stable"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
run: go test -v -count=1 ./...
vet:
name: Vet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run go vet
run: go vet ./...

303
README.md
View File

@@ -1,2 +1,301 @@
# gozel
Golang wrapper for Intel NEO driver Level Zero APIs.
# GoZeL
[![CI](https://github.com/fumiama/gozel/actions/workflows/ci.yml/badge.svg)](https://github.com/fumiama/gozel/actions/workflows/ci.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/fumiama/gozel.svg)](https://pkg.go.dev/github.com/fumiama/gozel)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
**gozel** is a pure-Go binding for the [Intel oneAPI Level Zero](https://github.com/oneapi-src/level-zero) API — enabling direct GPU/NPU compute from Go **without cgo**.
Built on [purego](https://github.com/ebitengine/purego) and Windows syscall, gozel loads `ze_loader` at runtime via FFI, avoiding all C compiler dependencies. The entire API surface is auto-generated from the official Level Zero SDK headers, keeping bindings always in sync with upstream.
---
## Table of Contents
- [Projects Using gozel](#projects-using-gozel)
- [Features](#features)
- [Platform Support](#platform-support)
- [Quick Start](#quick-start)
- [The `ze` Package — High-Level API](#the-ze-package--high-level-api)
- [Contributing](#contributing)
- [License](#license)
- [Appendix I. Architecture](#appendix-i-architecture)
- [Appendix II. Regenerating Bindings from Headers](#appendix-ii-regenerating-bindings-from-headers)
- [Appendix III. Building SPIR-V Kernels](#appendix-iii-building-spir-v-kernels)
---
## Projects Using gozel
We maintain a list of projects built with gozel. If your project uses this library, please open a PR to add it here!
| Project | Description | Link |
|---|---|---|
| | | |
## Features
- **No cgo** — Pure Go via [purego](https://github.com/ebitengine/purego) and Windows syscall. No C toolchain required at build time.
- **Auto-generated** — All 200+ Level Zero functions generated directly from the [official C headers](https://github.com/oneapi-src/level-zero/tree/master/include), covering Core, Sysman, Tools and Runtime APIs.
- **High-level wrapper** — The `ze` sub-package provides an idiomatic Go API over the raw bindings: typed handles, error returns, automatic resource lifetime.
- **Kernel in Go** — Embed SPIR-V binaries with `//go:embed`, load and launch GPU kernels entirely from Go.
- **Extensible** — Add new examples, wrap more APIs, or plug in your own SPIR-V pipelines.
## Platform Support
> gozel targets all Intel GPUs including Intel Arc / Iris Xe / Data Center GPUs that ship a Level Zero driver. Any device visible to `ze_loader` should work.
| OS | Architecture | Runtime Requirement |
|---|---|---|
| Windows | amd64 | [Intel GPU driver](https://www.intel.com/content/www/us/en/download/785597/intel-arc-iris-xe-graphics-windows.html) with `ze_loader.dll` |
| Linux | amd64 | [Intel compute-runtime](https://github.com/intel/compute-runtime) with `libze_loader.so` |
| More | under | testing... |
## Quick Start
### Install
```bash
go get github.com/fumiama/gozel
```
### Minimal Example
```go
package main
import (
"fmt"
"github.com/fumiama/gozel/ze"
)
func main() {
gpus, err := ze.InitGPUDrivers()
if err != nil {
panic(err)
}
fmt.Printf("Found %d GPU driver(s)\n", len(gpus))
devs, _ := gpus[0].DeviceGet()
for _, d := range devs {
prop, _ := d.DeviceGetProperties()
fmt.Printf(" Device: %s\n", string(prop.Name[:]))
}
// Found 1 GPU driver(s)
// Device: Graphics
}
```
### Vector-Add
This example adds up two large float32 vectors.
```bash
cd examples/vadd
# go generate # Optional, requires SYCL toolchain (see below)
go run main.go
```
You will see the result like
```bash
=============== Device Basic Properties ===============
Running on device: ID = 1 , Name = Graphics @ 4.00 GHz.
=============== Device Compute Properties ===============
Max Group Size (X, Y, Z): (1024, 1024, 1024)
Max Group Count (X, Y, Z): (4294967295, 4294967295, 4294967295)
Max Total Group Size: 1024
Max Shared Local Memory: 65536
Num Subgroup Sizes: 3
Subgroup Sizes: [8 16 32 0 0 0 0 0]
=============== Computation Configuration ===============
Group Size (X, Y, Z): (1024, 1, 1)
Group Count: 65536
Total Elements (N): 67108864
Buffer Size: 256 MiB
=============== Calculation Results ===============
GPU Execution Time: 56.114500 ms
GPU Throughput: 4.78 GiB/s
=============== Validation Results ===============
CPU Execution Time: 77.190700 ms
CPU Throughput: 3.48 GiB/s
Test Passed!!!
```
### More Examples
| Example | Description | Source |
|---|---|---|
| **vadd** | Vector addition — GPU kernel launch, memory copy, validation | [examples/vadd](examples/vadd/) |
## The `ze` Package — High-Level API
All examples used `ze` sub-package, which wraps the raw Level Zero bindings into idiomatic Go with typed handles and method chains:
```go
// Initialize
gpus, _ := ze.InitGPUDrivers()
// Context + Device
ctx, _ := gpus[0].ContextCreate()
devs, _ := gpus[0].DeviceGet()
// Memory
hostBuf, _ := ctx.MemAllocHost(size, alignment)
devBuf, _ := ctx.MemAllocDevice(devs[0], size, alignment)
defer ctx.MemFree(hostBuf)
defer ctx.MemFree(devBuf)
// Module + Kernel
mod, _ := ctx.ModuleCreate(devs[0], spirvBytes)
krn, _ := mod.KernelCreate("my_kernel")
krn.SetArgumentValue(0, unsafe.Sizeof(uintptr(0)), unsafe.Pointer(&devBuf))
krn.SetGroupSize(256, 1, 1)
// Command submission
q, _ := ctx.CommandQueueCreate(devs[0])
cl, _ := ctx.CommandListCreate(devs[0])
cl.AppendMemoryCopy(devBuf, hostBuf, size)
cl.AppendBarrier()
cl.AppendLaunchKernel(krn, &gozel.ZeGroupCount{Groupcountx: 4, Groupcounty: 1, Groupcountz: 1})
cl.AppendBarrier()
cl.Close()
q.ExecuteCommandLists(cl)
q.Synchronize()
```
Compared to the raw `gozel.ZeCommandListCreate(...)` calls, the `ze` package:
- Eliminates boilerplate descriptor initialization (struct types, `Stype` fields)
- Returns Go `error` instead of `ZeResult` codes
- Provides method syntax on handles (`ctx.CommandListCreate(dev)` vs standalone functions)
- Manages handle lifetimes with `defer`-friendly `Destroy()` methods
The `ze` package currently covers the most common workflows. **Contributions to expand coverage are very welcome** — see [Contributing](#contributing).
> 🙌 **Have an example to share?** We'd love to grow this table — see [Contributing](#contributing).
## Contributing
Contributions of all kinds are welcome. Some particularly impactful areas:
- **Examples** — Add new `examples/` demonstrating different GPU compute patterns (matrix multiply, reduction, image processing, etc.). Every example helps new users get started faster.
- **`ze` package coverage** — The high-level wrapper doesn't cover the full Level Zero surface yet. Wrapping additional APIs (events, fences, images, sysman queries, etc.) directly benefits all downstream users.
- **Testing** — Help improve test coverage across packages.
- **Documentation** — Improve godoc comments, add usage guides, or translate documentation.
- **Project showcase** — If you use gozel in your project, open a PR to add it to the [Projects Using gozel](#projects-using-gozel) table above.
## License
This project is licensed under the [GNU Affero General Public License v3.0](LICENSE).
---
## Appendix I. Architecture
The FFI layer (`internal/zecall`) loads the Level Zero loader library at runtime, caches procedure addresses, and dispatches calls through `purego` or Windows syscall. All pointer arguments are protected against GC collection during syscalls via `go:uintptrescapes`.
```
gozel/
├── api.go # Auto-generated: registers all L0 functions at init
├── core_*.go # Auto-generated: Core API bindings (ze*)
├── rntm_*.go # Auto-generated: Runtime API bindings (zer*)
├── sysm_*.go # Auto-generated: Sysman API bindings (zes*)
├── tols_*.go # Auto-generated: Tools API bindings (zet*)
├── ze/ # High-level idiomatic Go wrapper
│ ├── init.go # Driver initialization
│ ├── context.go # Context management
│ ├── device.go # Device enumeration & properties
│ ├── module.go # SPIR-V module loading
│ ├── kernel.go # Kernel creation & argument binding
│ ├── mem.go # Device/host memory allocation
│ └── command.go # Command queues, lists, barriers
├── internal/zecall/ # purego FFI layer (loads ze_loader at runtime)
├── cmd/gen/ # Code generator: parses L0 headers → Go source
├── cmd/func2kernel/ # LLVM IR transformer for SPIR-V kernel preparation
├── spec/ # Optional L0 SDK headers for dev purpose (input to cmd/gen)
└── examples/
├── quick_start/ # The quick start shown in this README
└── vadd/ # Vector addition: SYCL kernel + Go host
```
## Appendix II. Regenerating Bindings from Headers
gozel includes a code generator (`cmd/gen`) that parses the four Level Zero API headers and produces all `core_*.go`, `rntm_*.go`, `sysm_*.go`, `tols_*.go` files plus `api.go`.
### From a local SDK
Place (or symlink) the Level Zero SDK under `spec/`:
```
spec/
├── include/level_zero/
│ ├── ze_api.h # Core
│ ├── zer_api.h # Runtime
│ ├── zes_api.h # Sysman
│ └── zet_api.h # Tools
└── lib/
```
Then run:
```bash
go run ./cmd/gen -spec ./spec
```
### From a specific release
The generator can download the SDK directly from the [level-zero releases](https://github.com/oneapi-src/level-zero/releases):
```bash
go run ./cmd/gen -spec v1.28.0
```
### Via `go generate`
```bash
go generate .
```
This invokes `cmd/gen` with the local `spec/` directory as configured in `doc.go`.
## Appendix III. Building SPIR-V Kernels
GPU kernels in the [examples](examples) folder are written in SYCL C++ and compiled to SPIR-V for embedding into Go programs, which is a little bit hacky. You can also use `ocloc`, which is a common practice and you can search for the build doc elsewhere. The build pipeline uses `go generate` directives:
```
main.cpp ──clang++ -fsycl──▶ device_func.bc
sycl-post-link
▼ device_func_0.bc
clang++ -emit-llvm -S
▼ device_func.ll
cmd/func2kernel ← transforms spir_func → spir_kernel
▼ device_kern.ll
llvm-spirv
▼ main.spv ← embedded via //go:embed
```
### Prerequisites
- [Intel LLVM SYCL Compiler](https://github.com/intel/llvm) (provides `clang++` with SYCL support, `sycl-post-link`, etc.)
### Build
```bash
cd examples/vadd
go generate # compiles main.cpp → main.spv
go run main.go # runs vector addition on GPU
```
The `cmd/func2kernel` tool handles the LLVM IR transformation (`spir_func``spir_kernel`, address space 4 → 1) required by the SPIR-V backend.

1018
api.go

File diff suppressed because it is too large Load Diff

View File

@@ -31,6 +31,8 @@ import (
"github.com/fumiama/gozel/internal/zecall"
)
const debug = false
func init() {
`)
}
@@ -38,7 +40,7 @@ func init() {
func addAPI(name string) {
apif.WriteString("\n\tif err := zecall.Register(\"")
apif.WriteString(name)
apif.WriteString("\"); err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"[gozel.warn]\", err)\n\t}\n")
apif.WriteString("\"); debug && err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"[gozel.warn]\", err)\n\t}\n")
}
func closeAPI() {

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"os"
"strconv"
"strings"
"unicode"
)
@@ -18,7 +19,9 @@ var (
typemap = map[string]string{
"char": "byte",
"char*": "*byte",
"char *": "*byte",
"const char*": "*byte",
"const char *": "*byte",
"char**": "**byte",
"const char**": "**byte",
"char***": "***byte",
@@ -51,6 +54,8 @@ var (
"core_globaloffset": {},
"core_linkonceodr": {},
"core_subgroups": {},
"tols_metricRuntimeEnableDisable": {},
}
zecallExcludeRegions = map[string]struct{}{
"core_bandwidth": {},
@@ -86,7 +91,13 @@ var (
"sysm_memPageOfflineState": {},
"sysm_powerDomainProperties": {},
"tols_common": {},
"tols_common": {},
"tols_metricExportMemory": {},
}
unionSizes = map[string]int{
"zet_value_t": 8,
"zet_debug_event_info_t": 32,
"zet_value_info_exp_t": 16,
}
)
@@ -106,6 +117,7 @@ func scanHeader(name string, scan *bufio.Scanner) {
var regionfile *os.File
fileheadersb := strings.Builder{}
region := ""
fsz := int64(0)
for scan.Scan() {
ln++
t := scan.Text()
@@ -146,6 +158,11 @@ func scanHeader(name string, scan *bufio.Scanner) {
f.WriteString(sb.String())
}
regionfile = f
stat, err := f.Stat()
if err != nil {
panic(fmt.Sprintf("%s L%d: cannot stat region file %s, err: %v", name, ln, region, err))
}
fsz = stat.Size()
// block barrier
case strings.HasPrefix(t, "///////////////////////////////////////////////////////////////////////////////"):
fmt.Println(" [scan] enter", region, "block")
@@ -153,8 +170,18 @@ func scanHeader(name string, scan *bufio.Scanner) {
fmt.Println(" [scan] leave", region, "block")
// pragma end
case strings.HasPrefix(t, "#pragma endregion"):
fmt.Println(infh(name), "close region", regionfile.Name())
nm := regionfile.Name()
stat, err := regionfile.Stat()
if err != nil {
panic(fmt.Sprintf("%s L%d: cannot stat region file %s, err: %v", name, ln, region, err))
}
sz := stat.Size()
fmt.Println(infh(name), "close region", nm)
_ = regionfile.Close()
if fsz == sz {
fmt.Println("[warn] delete unchanged region file", nm)
_ = os.Remove(nm)
}
regionfile = nil
// skip outer #
case strings.HasPrefix(t, "#") || t == "" || strings.HasPrefix(t, "// ") ||
@@ -615,6 +642,7 @@ func scanTypedef(
f.WriteString(vars)
f.WriteString("\n)\n\n")
return ln
// tricky: fallthrough union to the single line though it is not
}
}
// single-line typedef, empty struct or type alias, replace with "type" statement
@@ -635,6 +663,13 @@ func scanTypedef(
typs = typs[1:]
typs[0] = "uintptr"
typs[1] = strings.TrimPrefix(strings.TrimSpace(typs[1]), "*")
} else if strings.TrimSpace(typs[0]) == "union" {
origtyp := strings.TrimSpace(strings.TrimSuffix(strings.TrimSpace(typs[len(typs)-1]), ";"))
sz, ok := unionSizes[origtyp]
if !ok {
panic(fmt.Sprintf("%s L%d: unknown union size of %s", name, ln, origtyp))
}
typs = []string{"[" + strconv.Itoa(sz) + "]byte", origtyp}
}
if len(typs) != 2 {
panic(fmt.Sprintf("%s L%d: unexpected typdef line %s", name, ln, firstln))
@@ -706,6 +741,9 @@ func scanFunc(
panic(fmt.Sprintf("%s L%d: unexpected short func arg line %s", name, ln, argln))
}
argnam := strings.TrimSpace(argtypnam[i+1:])
if argnam == "type" { // go keywords
argnam = "typ"
}
argsb.WriteString(", uintptr(")
argtyp := strings.TrimSpace(strings.ReplaceAll(argtypnam[:i], "const ", ""))
isp := strings.HasSuffix(argtyp, "*") // is pointer
@@ -719,7 +757,7 @@ func scanFunc(
}
if isp {
if !ok {
argtyp = pmark + argtyp[:len(argtyp)-len(pmark)]
argtyp = pmark + strings.TrimSpace(argtyp[:len(argtyp)-len(pmark)])
}
argsb.WriteString("unsafe.Pointer(")
} else {

View File

@@ -66,7 +66,7 @@ func get1sentence(firstln string, scan *bufio.Scanner, ln int) (string, int) {
}
sb.WriteString(t)
content, _, _ := strings.Cut(t, "//")
if strings.Contains(content, ";") && bracedepth == 0 {
if bracedepth == 0 && strings.Contains(content, ";") {
return sb.String(), ln
}
}

2
doc.go
View File

@@ -1,3 +1,3 @@
package gozel
//go:generate go run ./cmd/gen -spec ./spec
//go:generate go run ./cmd/gen

View File

@@ -0,0 +1,24 @@
package main
import (
"fmt"
"github.com/fumiama/gozel/ze"
)
func main() {
gpus, err := ze.InitGPUDrivers()
if err != nil {
panic(err)
}
fmt.Printf("Found %d GPU driver(s)\n", len(gpus))
devs, _ := gpus[0].DeviceGet()
for _, d := range devs {
prop, _ := d.DeviceGetProperties()
fmt.Printf(" Device: %s\n", string(prop.Name[:]))
}
// Found 1 GPU driver(s)
// Device: Graphics
}

View File

@@ -5,6 +5,9 @@ import (
"fmt"
"math/rand"
"os"
"strconv"
"strings"
"time"
"unsafe"
"github.com/fumiama/gozel"
@@ -22,18 +25,7 @@ import (
//go:embed main.spv
var kernelspv []byte
const (
X, Y, Z = 64, 1, 1
N = X * Y * Z
bufsz = N * unsafe.Sizeof(float32(0))
)
func main() {
floatbuf := make([]float32, 2*N)
for i := range floatbuf {
floatbuf[i] = rand.Float32()
}
gpus, err := ze.InitGPUDrivers()
if err != nil {
panic(err)
@@ -57,6 +49,42 @@ func main() {
}
dev := devs[0]
prop, err := dev.DeviceGetProperties()
if err != nil {
panic(err)
}
fmt.Println("=============== Device Basic Properties ===============")
fmt.Println(
"Running on device: ID =", prop.Deviceid, ", Name =",
strings.TrimSpace(string(prop.Name[:])),
"@", strconv.FormatFloat(float64(prop.Coreclockrate)/1024/1024/1024, 'f', 2, 64), "GHz.",
)
cprop, err := dev.DeviceGetComputeProperties()
if err != nil {
panic(err)
}
fmt.Println("=============== Device Compute Properties ===============")
fmt.Printf("%-28s (%d, %d, %d)\n", "Max Group Size (X, Y, Z):", cprop.Maxgroupsizex, cprop.Maxgroupsizey, cprop.Maxgroupsizez)
fmt.Printf("%-28s (%d, %d, %d)\n", "Max Group Count (X, Y, Z):", cprop.Maxgroupcountx, cprop.Maxgroupcounty, cprop.Maxgroupcountz)
fmt.Printf("%-28s %d\n", "Max Total Group Size:", cprop.Maxtotalgroupsize)
fmt.Printf("%-28s %d\n", "Max Shared Local Memory:", cprop.Maxsharedlocalmemory)
fmt.Printf("%-28s %d\n", "Num Subgroup Sizes:", cprop.Numsubgroupsizes)
fmt.Printf("%-28s %v\n", "Subgroup Sizes:", cprop.Subgroupsizes[:])
var (
X, Y, Z = uintptr(cprop.Maxgroupsizex), uintptr(1), uintptr(1)
groupCount = uintptr(65536)
N = X * groupCount
bufsz = N * unsafe.Sizeof(float32(0))
)
fmt.Println("=============== Computation Configuration ===============")
fmt.Printf("%-28s (%d, %d, %d)\n", "Group Size (X, Y, Z):", X, Y, Z)
fmt.Printf("%-28s %d\n", "Group Count:", groupCount)
fmt.Printf("%-28s %d\n", "Total Elements (N):", N)
fmt.Printf("%-28s %d MiB\n", "Buffer Size:", bufsz/1024/1024)
q, err := ctx.CommandQueueCreate(dev)
if err != nil {
panic(err)
@@ -87,6 +115,11 @@ func main() {
}
defer ctx.MemFree(dbuf_v2)
floatbuf := make([]float32, 2*N)
for i := range floatbuf {
floatbuf[i] = rand.Float32()
}
zev1, zev2 := unsafe.Slice((*float32)(hbuf_v1), N), unsafe.Slice((*float32)(hbuf_v2), N)
copy(zev1, floatbuf[:N])
copy(zev2, floatbuf[N:])
@@ -111,62 +144,100 @@ func main() {
if err != nil {
panic(err)
}
err = krn.SetGroupSize(X, Y, Z)
err = krn.SetGroupSize(uint32(X), uint32(Y), uint32(Z))
if err != nil {
panic(err)
}
lst, err := ctx.CommandListCreate(dev)
lstpre, err := ctx.CommandListCreate(dev)
if err != nil {
panic(err)
}
defer lst.Destroy()
defer lstpre.Destroy()
err = lst.AppendMemoryCopy(dbuf_v1, hbuf_v1, bufsz)
err = lstpre.AppendMemoryCopy(dbuf_v1, hbuf_v1, bufsz)
if err != nil {
panic(err)
}
err = lst.AppendMemoryCopy(dbuf_v2, hbuf_v2, bufsz)
err = lstpre.AppendMemoryCopy(dbuf_v2, hbuf_v2, bufsz)
if err != nil {
panic(err)
}
err = lst.AppendBarrier()
err = lstpre.AppendBarrier()
if err != nil {
panic(err)
}
err = lst.AppendLaunchKernel(krn, &gozel.ZeGroupCount{
Groupcountx: 1, Groupcounty: 1, Groupcountz: 1,
err = lstpre.Close()
if err != nil {
panic(err)
}
lstcalc, err := ctx.CommandListCreate(dev)
if err != nil {
panic(err)
}
defer lstcalc.Destroy()
err = lstcalc.AppendLaunchKernel(krn, &gozel.ZeGroupCount{
Groupcountx: uint32(groupCount), Groupcounty: 1, Groupcountz: 1,
})
if err != nil {
panic(err)
}
err = lst.AppendBarrier()
err = lstcalc.AppendBarrier()
if err != nil {
panic(err)
}
err = lst.AppendMemoryCopy(hbuf_v1, dbuf_v1, bufsz)
err = lstcalc.Close()
if err != nil {
panic(err)
}
err = lst.Close()
lstpost, err := ctx.CommandListCreate(dev)
if err != nil {
panic(err)
}
defer lstpost.Destroy()
err = lstpost.AppendMemoryCopy(hbuf_v1, dbuf_v1, bufsz)
if err != nil {
panic(err)
}
err = q.ExecuteCommandLists(lst)
err = lstpost.Close()
if err != nil {
panic(err)
}
start := time.Now()
err = q.ExecuteCommandLists(lstpre, lstcalc, lstpost)
if err != nil {
panic(err)
}
err = q.Synchronize()
if err != nil {
panic(err)
}
elapsed := time.Since(start)
fmt.Println("=============== Calculation Results ===============")
fmt.Printf("%-28s %.6f ms\n", "GPU Execution Time:", elapsed.Seconds()*1000)
fmt.Printf("%-28s %.2f GiB/s\n", "GPU Throughput:", float64(bufsz)/elapsed.Seconds()/1e9)
tmpbuf := make([]float32, N)
start = time.Now()
for i := range N {
tmpbuf[i] = floatbuf[i] + floatbuf[N+i]
}
elapsed = time.Since(start)
fmt.Println("=============== Validation Results ===============")
fmt.Printf("%-28s %.6f ms\n", "CPU Execution Time:", elapsed.Seconds()*1000)
fmt.Printf("%-28s %.2f GiB/s\n", "CPU Throughput:", float64(bufsz)/elapsed.Seconds()/1e9)
fail := false
for i := range N {
@@ -175,11 +246,13 @@ func main() {
fail = true
fmt.Printf("[%05d] expect %f = %f + %f, got %f.\n", i, expect, floatbuf[i], floatbuf[N+i], zev1[i])
} else {
fmt.Printf("[%05d] valid %f = %f + %f, got %f.\n", i, expect, floatbuf[i], floatbuf[N+i], zev1[i])
// fmt.Printf("[%05d] valid %f = %f + %f, got %f.\n", i, expect, floatbuf[i], floatbuf[N+i], zev1[i])
}
}
if fail {
os.Exit(1)
}
fmt.Println("Test Passed!!!")
}

83
tols_GlobalTimestamps.go Normal file
View File

@@ -0,0 +1,83 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZET_GLOBAL_METRICS_TIMESTAMPS_EXP_NAME Global Metric Timestamps Experimental Extension Name
const ZET_GLOBAL_METRICS_TIMESTAMPS_EXP_NAME = "ZET_experimental_global_metric_timestamps"
// ZeMetricGlobalTimestampsExpVersion (ze_metric_global_timestamps_exp_version_t) Global Metric Timestamps Experimental Extension Version(s)
type ZeMetricGlobalTimestampsExpVersion uintptr
const (
ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_1_0 ZeMetricGlobalTimestampsExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_1_0 version 1.0
ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_CURRENT ZeMetricGlobalTimestampsExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_CURRENT latest known version
ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_FORCE_UINT32 ZeMetricGlobalTimestampsExpVersion = 0x7fffffff // ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_FORCE_UINT32 Value marking end of ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_* ENUMs
)
// ZetMetricGlobalTimestampsResolutionExp (zet_metric_global_timestamps_resolution_exp_t) Metric timestamps resolution
///
/// @details
/// - This structure may be returned from ::zetMetricGroupGetProperties via
/// the `pNext` member of ::zet_metric_group_properties_t.
/// - Used for mapping metric timestamps to other timers.
type ZetMetricGlobalTimestampsResolutionExp struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Timerresolution uint64 // Timerresolution [out] Returns the resolution of metrics timer (used for timestamps) in cycles/sec.
Timestampvalidbits uint64 // Timestampvalidbits [out] Returns the number of valid bits in the timestamp value.
}
// ZetMetricGroupGetGlobalTimestampsExp Returns metric timestamps synchronized with global device timestamps,
/// optionally synchronized with host
///
/// @details
/// - The application may call this function from simultaneous threads.
/// - By default, the global and metrics timestamps are synchronized to the
/// device.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == globalTimestamp`
/// + `nullptr == metricTimestamp`
func ZetMetricGroupGetGlobalTimestampsExp(
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] handle of the metric group
synchronizedWithHost ZeBool, // synchronizedWithHost [in] Returns the timestamps synchronized to the host or the device.
globalTimestamp *uint64, // globalTimestamp [out] Device timestamp.
metricTimestamp *uint64, // metricTimestamp [out] Metric timestamp.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupGetGlobalTimestampsExp", uintptr(hMetricGroup), uintptr(synchronizedWithHost), uintptr(unsafe.Pointer(globalTimestamp)), uintptr(unsafe.Pointer(metricTimestamp)))
}

View File

@@ -118,3 +118,13 @@ const (
)
// ZetValue (zet_value_t) Union of values
type ZetValue [8]byte
// ZetTypedValue (zet_typed_value_t) Typed value
type ZetTypedValue struct {
Type ZetValueType // Type [out] type of value
Value ZetValue // Value [out] value
}

View File

@@ -0,0 +1,65 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZET_CONCURRENT_METRIC_GROUPS_EXP_NAME Concurrent Metric Groups Experimental Extension Name
const ZET_CONCURRENT_METRIC_GROUPS_EXP_NAME = "ZET_experimental_concurrent_metric_groups"
// ZetConcurrentMetricGroupsExpVersion (zet_concurrent_metric_groups_exp_version_t) Concurrent Metric Groups Experimental Extension Version(s)
type ZetConcurrentMetricGroupsExpVersion uintptr
const (
ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_1_0 ZetConcurrentMetricGroupsExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_1_0 version 1.0
ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_CURRENT ZetConcurrentMetricGroupsExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_CURRENT latest known version
ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_FORCE_UINT32 ZetConcurrentMetricGroupsExpVersion = 0x7fffffff // ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_FORCE_UINT32 Value marking end of ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_* ENUMs
)
// ZetDeviceGetConcurrentMetricGroupsExp Get sets of metric groups which could be collected concurrently.
///
/// @details
/// - Re-arrange the input metric groups to provide sets of concurrent
/// metric groups.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
func ZetDeviceGetConcurrentMetricGroupsExp(
hDevice ZetDeviceHandle, // hDevice [in] handle of the device
metricGroupCount uint32, // metricGroupCount [in] metric group count
phMetricGroups *ZetMetricGroupHandle, // phMetricGroups [in,out] metrics groups to be re-arranged to be sets of concurrent groups
pMetricGroupsCountPerConcurrentGroup *uint32, // pMetricGroupsCountPerConcurrentGroup [in,out][optional][*pConcurrentGroupCount] count of metric groups per concurrent group.
pConcurrentGroupCount *uint32, // pConcurrentGroupCount [out] number of concurrent groups. The value of this parameter could be used to determine the number of replays necessary.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDeviceGetConcurrentMetricGroupsExp", uintptr(hDevice), uintptr(metricGroupCount), uintptr(unsafe.Pointer(phMetricGroups)), uintptr(unsafe.Pointer(pMetricGroupsCountPerConcurrentGroup)), uintptr(unsafe.Pointer(pConcurrentGroupCount)))
}

570
tols_debug.go Normal file
View File

@@ -0,0 +1,570 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZetDeviceDebugPropertyFlags (zet_device_debug_property_flags_t) Supported device debug property flags
type ZetDeviceDebugPropertyFlags uint32
const (
ZET_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH ZetDeviceDebugPropertyFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZET_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH the device supports attaching for debug
ZET_DEVICE_DEBUG_PROPERTY_FLAG_FORCE_UINT32 ZetDeviceDebugPropertyFlags = 0x7fffffff // ZET_DEVICE_DEBUG_PROPERTY_FLAG_FORCE_UINT32 Value marking end of ZET_DEVICE_DEBUG_PROPERTY_FLAG_* ENUMs
)
// ZetDeviceDebugProperties (zet_device_debug_properties_t) Device debug properties queried using ::zetDeviceGetDebugProperties.
type ZetDeviceDebugProperties struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Flags ZetDeviceDebugPropertyFlags // Flags [out] returns 0 (none) or a valid combination of ::zet_device_debug_property_flag_t
}
// ZetDeviceGetDebugProperties Retrieves debug properties of the device.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pDebugProperties`
func ZetDeviceGetDebugProperties(
hDevice ZetDeviceHandle, // hDevice [in] device handle
pDebugProperties *ZetDeviceDebugProperties, // pDebugProperties [in,out] query result for debug properties
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDeviceGetDebugProperties", uintptr(hDevice), uintptr(unsafe.Pointer(pDebugProperties)))
}
// ZetDebugConfig (zet_debug_config_t) Debug configuration provided to ::zetDebugAttach
type ZetDebugConfig struct {
Pid uint32 // Pid [in] the host process identifier
}
// ZetDebugAttach Attach to a device.
///
/// @details
/// - The device must be enabled for debug; see
/// ::zesSchedulerSetComputeUnitDebugMode.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == config`
/// + `nullptr == phDebug`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// + attaching to this device is not supported
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// + caller does not have sufficient permissions
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// + a debugger is already attached
func ZetDebugAttach(
hDevice ZetDeviceHandle, // hDevice [in] device handle
config *ZetDebugConfig, // config [in] the debug configuration
phDebug *ZetDebugSessionHandle, // phDebug [out] debug session handle
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugAttach", uintptr(hDevice), uintptr(unsafe.Pointer(config)), uintptr(unsafe.Pointer(phDebug)))
}
// ZetDebugDetach Close a debug session.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDebug`
func ZetDebugDetach(
hDebug ZetDebugSessionHandle, // hDebug [in][release] debug session handle
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugDetach", uintptr(hDebug))
}
// ZetDebugEventFlags (zet_debug_event_flags_t) Supported debug event flags.
type ZetDebugEventFlags uint32
const (
ZET_DEBUG_EVENT_FLAG_NEED_ACK ZetDebugEventFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZET_DEBUG_EVENT_FLAG_NEED_ACK The event needs to be acknowledged by calling
///< ::zetDebugAcknowledgeEvent.
ZET_DEBUG_EVENT_FLAG_FORCE_UINT32 ZetDebugEventFlags = 0x7fffffff // ZET_DEBUG_EVENT_FLAG_FORCE_UINT32 Value marking end of ZET_DEBUG_EVENT_FLAG_* ENUMs
)
// ZetDebugEventType (zet_debug_event_type_t) Supported debug event types.
type ZetDebugEventType uintptr
const (
ZET_DEBUG_EVENT_TYPE_INVALID ZetDebugEventType = 0 // ZET_DEBUG_EVENT_TYPE_INVALID The event is invalid
ZET_DEBUG_EVENT_TYPE_DETACHED ZetDebugEventType = 1 // ZET_DEBUG_EVENT_TYPE_DETACHED The tool was detached
ZET_DEBUG_EVENT_TYPE_PROCESS_ENTRY ZetDebugEventType = 2 // ZET_DEBUG_EVENT_TYPE_PROCESS_ENTRY The debuggee process created command queues on the device
ZET_DEBUG_EVENT_TYPE_PROCESS_EXIT ZetDebugEventType = 3 // ZET_DEBUG_EVENT_TYPE_PROCESS_EXIT The debuggee process destroyed all command queues on the device
ZET_DEBUG_EVENT_TYPE_MODULE_LOAD ZetDebugEventType = 4 // ZET_DEBUG_EVENT_TYPE_MODULE_LOAD An in-memory module was loaded onto the device
ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD ZetDebugEventType = 5 // ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD An in-memory module is about to get unloaded from the device
ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED ZetDebugEventType = 6 // ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED The thread stopped due to a device exception
ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE ZetDebugEventType = 7 // ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE The thread is not available to be stopped
ZET_DEBUG_EVENT_TYPE_PAGE_FAULT ZetDebugEventType = 8 // ZET_DEBUG_EVENT_TYPE_PAGE_FAULT A page request could not be completed on the device
ZET_DEBUG_EVENT_TYPE_FORCE_UINT32 ZetDebugEventType = 0x7fffffff // ZET_DEBUG_EVENT_TYPE_FORCE_UINT32 Value marking end of ZET_DEBUG_EVENT_TYPE_* ENUMs
)
// ZetDebugDetachReason (zet_debug_detach_reason_t) Supported debug detach reasons.
type ZetDebugDetachReason uintptr
const (
ZET_DEBUG_DETACH_REASON_INVALID ZetDebugDetachReason = 0 // ZET_DEBUG_DETACH_REASON_INVALID The detach reason is not valid
ZET_DEBUG_DETACH_REASON_HOST_EXIT ZetDebugDetachReason = 1 // ZET_DEBUG_DETACH_REASON_HOST_EXIT The host process exited
ZET_DEBUG_DETACH_REASON_FORCE_UINT32 ZetDebugDetachReason = 0x7fffffff // ZET_DEBUG_DETACH_REASON_FORCE_UINT32 Value marking end of ZET_DEBUG_DETACH_REASON_* ENUMs
)
// ZetDebugEventInfoDetached (zet_debug_event_info_detached_t) Event information for ::ZET_DEBUG_EVENT_TYPE_DETACHED
type ZetDebugEventInfoDetached struct {
Reason ZetDebugDetachReason // Reason [out] the detach reason
}
// ZetDebugEventInfoModule (zet_debug_event_info_module_t) Event information for ::ZET_DEBUG_EVENT_TYPE_MODULE_LOAD and
/// ::ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD
type ZetDebugEventInfoModule struct {
Format ZetModuleDebugInfoFormat // Format [out] the module format
Modulebegin uint64 // Modulebegin [out] the begin address of the in-memory module (inclusive)
Moduleend uint64 // Moduleend [out] the end address of the in-memory module (exclusive)
Load uint64 // Load [out] the load address of the module on the device
}
// ZetDebugEventInfoThreadStopped (zet_debug_event_info_thread_stopped_t) Event information for ::ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED and
/// ::ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE
type ZetDebugEventInfoThreadStopped struct {
Thread ZeDeviceThread // Thread [out] the stopped/unavailable thread
}
// ZetDebugPageFaultReason (zet_debug_page_fault_reason_t) Page fault reasons.
type ZetDebugPageFaultReason uintptr
const (
ZET_DEBUG_PAGE_FAULT_REASON_INVALID ZetDebugPageFaultReason = 0 // ZET_DEBUG_PAGE_FAULT_REASON_INVALID The page fault reason is not valid
ZET_DEBUG_PAGE_FAULT_REASON_MAPPING_ERROR ZetDebugPageFaultReason = 1 // ZET_DEBUG_PAGE_FAULT_REASON_MAPPING_ERROR The address is not mapped
ZET_DEBUG_PAGE_FAULT_REASON_PERMISSION_ERROR ZetDebugPageFaultReason = 2 // ZET_DEBUG_PAGE_FAULT_REASON_PERMISSION_ERROR Invalid access permissions
ZET_DEBUG_PAGE_FAULT_REASON_FORCE_UINT32 ZetDebugPageFaultReason = 0x7fffffff // ZET_DEBUG_PAGE_FAULT_REASON_FORCE_UINT32 Value marking end of ZET_DEBUG_PAGE_FAULT_REASON_* ENUMs
)
// ZetDebugEventInfoPageFault (zet_debug_event_info_page_fault_t) Event information for ::ZET_DEBUG_EVENT_TYPE_PAGE_FAULT
type ZetDebugEventInfoPageFault struct {
Address uint64 // Address [out] the faulting address
Mask uint64 // Mask [out] the alignment mask
Reason ZetDebugPageFaultReason // Reason [out] the page fault reason
}
// ZetDebugEventInfo (zet_debug_event_info_t) Event type-specific information
type ZetDebugEventInfo [32]byte
// ZetDebugEvent (zet_debug_event_t) A debug event on the device.
type ZetDebugEvent struct {
Type ZetDebugEventType // Type [out] the event type
Flags ZetDebugEventFlags // Flags [out] returns 0 (none) or a combination of ::zet_debug_event_flag_t
Info ZetDebugEventInfo // Info [out] event type specific information
}
// ZetDebugReadEvent Read the topmost debug event.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDebug`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == event`
/// - ::ZE_RESULT_NOT_READY
/// + the timeout expired
func ZetDebugReadEvent(
hDebug ZetDebugSessionHandle, // hDebug [in] debug session handle
timeout uint64, // timeout [in] if non-zero, then indicates the maximum time (in milliseconds) to yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; if zero, then immediately returns the status of the event; if `UINT64_MAX`, then function will not return until complete or device is lost. Due to external dependencies, timeout may be rounded to the closest value allowed by the accuracy of those dependencies.
event *ZetDebugEvent, // event [in,out] a pointer to a ::zet_debug_event_t.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugReadEvent", uintptr(hDebug), uintptr(timeout), uintptr(unsafe.Pointer(event)))
}
// ZetDebugAcknowledgeEvent Acknowledge a debug event.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDebug`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == event`
func ZetDebugAcknowledgeEvent(
hDebug ZetDebugSessionHandle, // hDebug [in] debug session handle
event *ZetDebugEvent, // event [in] a pointer to a ::zet_debug_event_t.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugAcknowledgeEvent", uintptr(hDebug), uintptr(unsafe.Pointer(event)))
}
// ZetDebugInterrupt Interrupt device threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDebug`
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// + the thread is already stopped or unavailable
func ZetDebugInterrupt(
hDebug ZetDebugSessionHandle, // hDebug [in] debug session handle
thread *ZeDeviceThread, // thread [in] the thread to interrupt (gozel hack: converted to a hidden pointer from a struct value)
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugInterrupt", uintptr(hDebug), uintptr(unsafe.Pointer(thread)))
}
// ZetDebugResume Resume device threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDebug`
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// + the thread is already running or unavailable
func ZetDebugResume(
hDebug ZetDebugSessionHandle, // hDebug [in] debug session handle
thread *ZeDeviceThread, // thread [in] the thread to resume (gozel hack: converted to a hidden pointer from a struct value)
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugResume", uintptr(hDebug), uintptr(unsafe.Pointer(thread)))
}
// ZetDebugMemorySpaceType (zet_debug_memory_space_type_t) Supported device memory space types.
type ZetDebugMemorySpaceType uintptr
const (
ZET_DEBUG_MEMORY_SPACE_TYPE_DEFAULT ZetDebugMemorySpaceType = 0 // ZET_DEBUG_MEMORY_SPACE_TYPE_DEFAULT default memory space (attribute may be omitted)
ZET_DEBUG_MEMORY_SPACE_TYPE_SLM ZetDebugMemorySpaceType = 1 // ZET_DEBUG_MEMORY_SPACE_TYPE_SLM shared local memory space (GPU-only)
ZET_DEBUG_MEMORY_SPACE_TYPE_ELF ZetDebugMemorySpaceType = 2 // ZET_DEBUG_MEMORY_SPACE_TYPE_ELF ELF file memory space
ZET_DEBUG_MEMORY_SPACE_TYPE_BARRIER ZetDebugMemorySpaceType = 3 // ZET_DEBUG_MEMORY_SPACE_TYPE_BARRIER Barrier memory space
ZET_DEBUG_MEMORY_SPACE_TYPE_FORCE_UINT32 ZetDebugMemorySpaceType = 0x7fffffff // ZET_DEBUG_MEMORY_SPACE_TYPE_FORCE_UINT32 Value marking end of ZET_DEBUG_MEMORY_SPACE_TYPE_* ENUMs
)
// ZetDebugMemorySpaceDesc (zet_debug_memory_space_desc_t) Device memory space descriptor
type ZetDebugMemorySpaceDesc struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Type ZetDebugMemorySpaceType // Type [in] type of memory space
Address uint64 // Address [in] the virtual address within the memory space
}
// ZetDebugReadMemory Read memory.
///
/// @details
/// - The thread identifier 'all' can be used for accessing the default
/// memory space, e.g. for setting breakpoints.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDebug`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == desc`
/// + `nullptr == buffer`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `::ZET_DEBUG_MEMORY_SPACE_TYPE_BARRIER < desc->type`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// + the thread is running or unavailable
/// + the memory cannot be accessed from the supplied thread
func ZetDebugReadMemory(
hDebug ZetDebugSessionHandle, // hDebug [in] debug session handle
thread *ZeDeviceThread, // thread [in] the thread identifier. (gozel hack: converted to a hidden pointer from a struct value)
desc *ZetDebugMemorySpaceDesc, // desc [in] memory space descriptor
size uintptr, // size [in] the number of bytes to read
buffer unsafe.Pointer, // buffer [in,out] a buffer to hold a copy of the memory
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugReadMemory", uintptr(hDebug), uintptr(unsafe.Pointer(thread)), uintptr(unsafe.Pointer(desc)), uintptr(size), uintptr(unsafe.Pointer(buffer)))
}
// ZetDebugWriteMemory Write memory.
///
/// @details
/// - The thread identifier 'all' can be used for accessing the default
/// memory space, e.g. for setting breakpoints.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDebug`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == desc`
/// + `nullptr == buffer`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `::ZET_DEBUG_MEMORY_SPACE_TYPE_BARRIER < desc->type`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// + the thread is running or unavailable
/// + the memory cannot be accessed from the supplied thread
func ZetDebugWriteMemory(
hDebug ZetDebugSessionHandle, // hDebug [in] debug session handle
thread *ZeDeviceThread, // thread [in] the thread identifier. (gozel hack: converted to a hidden pointer from a struct value)
desc *ZetDebugMemorySpaceDesc, // desc [in] memory space descriptor
size uintptr, // size [in] the number of bytes to write
buffer unsafe.Pointer, // buffer [in] a buffer holding the pattern to write
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugWriteMemory", uintptr(hDebug), uintptr(unsafe.Pointer(thread)), uintptr(unsafe.Pointer(desc)), uintptr(size), uintptr(unsafe.Pointer(buffer)))
}
// ZetDebugRegsetFlags (zet_debug_regset_flags_t) Supported general register set flags.
type ZetDebugRegsetFlags uint32
const (
ZET_DEBUG_REGSET_FLAG_READABLE ZetDebugRegsetFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZET_DEBUG_REGSET_FLAG_READABLE register set is readable
ZET_DEBUG_REGSET_FLAG_WRITEABLE ZetDebugRegsetFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZET_DEBUG_REGSET_FLAG_WRITEABLE register set is writeable
ZET_DEBUG_REGSET_FLAG_FORCE_UINT32 ZetDebugRegsetFlags = 0x7fffffff // ZET_DEBUG_REGSET_FLAG_FORCE_UINT32 Value marking end of ZET_DEBUG_REGSET_FLAG_* ENUMs
)
// ZetDebugRegsetProperties (zet_debug_regset_properties_t) Device register set properties queried using
/// ::zetDebugGetRegisterSetProperties.
type ZetDebugRegsetProperties struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Type uint32 // Type [out] device-specific register set type
Version uint32 // Version [out] device-specific version of this register set
Generalflags ZetDebugRegsetFlags // Generalflags [out] general register set flags
Deviceflags uint32 // Deviceflags [out] device-specific register set flags
Count uint32 // Count [out] number of registers in the set
Bitsize uint32 // Bitsize [out] the size of a register in bits
Bytesize uint32 // Bytesize [out] the size required for reading or writing a register in bytes
}
// ZetDebugGetRegisterSetProperties Retrieves debug register set properties.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pCount`
func ZetDebugGetRegisterSetProperties(
hDevice ZetDeviceHandle, // hDevice [in] device handle
pCount *uint32, // pCount [in,out] pointer to the number of register set properties. if count is zero, then the driver shall update the value with the total number of register set properties available. if count is greater than the number of register set properties available, then the driver shall update the value with the correct number of registry set properties available.
pRegisterSetProperties *ZetDebugRegsetProperties, // pRegisterSetProperties [in,out][optional][range(0, *pCount)] array of query results for register set properties. if count is less than the number of register set properties available, then driver shall only retrieve that number of register set properties.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugGetRegisterSetProperties", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pRegisterSetProperties)))
}
// ZetDebugGetThreadRegisterSetProperties Retrieves debug register set properties for a given thread.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDebug`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pCount`
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// + the thread is running or unavailable
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + the thread argument specifies more than one or a non-existant thread
func ZetDebugGetThreadRegisterSetProperties(
hDebug ZetDebugSessionHandle, // hDebug [in] debug session handle
thread *ZeDeviceThread, // thread [in] the thread identifier specifying a single stopped thread (gozel hack: converted to a hidden pointer from a struct value)
pCount *uint32, // pCount [in,out] pointer to the number of register set properties. if count is zero, then the driver shall update the value with the total number of register set properties available. if count is greater than the number of register set properties available, then the driver shall update the value with the correct number of registry set properties available.
pRegisterSetProperties *ZetDebugRegsetProperties, // pRegisterSetProperties [in,out][optional][range(0, *pCount)] array of query results for register set properties. if count is less than the number of register set properties available, then driver shall only retrieve that number of register set properties.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugGetThreadRegisterSetProperties", uintptr(hDebug), uintptr(unsafe.Pointer(thread)), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(pRegisterSetProperties)))
}
// ZetDebugReadRegisters Read register state.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDebug`
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// + the thread is running or unavailable
func ZetDebugReadRegisters(
hDebug ZetDebugSessionHandle, // hDebug [in] debug session handle
thread *ZeDeviceThread, // thread [in] the thread identifier (gozel hack: converted to a hidden pointer from a struct value)
typ uint32, // typ [in] register set type
start uint32, // start [in] the starting offset into the register state area; must be less than the `count` member of ::zet_debug_regset_properties_t for the type
count uint32, // count [in] the number of registers to read; start+count must be less than or equal to the `count` member of ::zet_debug_regset_properties_t for the type
pRegisterValues unsafe.Pointer, // pRegisterValues [in,out][optional][range(0, count)] buffer of register values
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugReadRegisters", uintptr(hDebug), uintptr(unsafe.Pointer(thread)), uintptr(typ), uintptr(start), uintptr(count), uintptr(unsafe.Pointer(pRegisterValues)))
}
// ZetDebugWriteRegisters Write register state.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDebug`
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// + the thread is running or unavailable
func ZetDebugWriteRegisters(
hDebug ZetDebugSessionHandle, // hDebug [in] debug session handle
thread *ZeDeviceThread, // thread [in] the thread identifier (gozel hack: converted to a hidden pointer from a struct value)
typ uint32, // typ [in] register set type
start uint32, // start [in] the starting offset into the register state area; must be less than the `count` member of ::zet_debug_regset_properties_t for the type
count uint32, // count [in] the number of registers to write; start+count must be less than or equal to the `count` member of ::zet_debug_regset_properties_t for the type
pRegisterValues unsafe.Pointer, // pRegisterValues [in,out][optional][range(0, count)] buffer of register values
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDebugWriteRegisters", uintptr(hDebug), uintptr(unsafe.Pointer(thread)), uintptr(typ), uintptr(start), uintptr(count), uintptr(unsafe.Pointer(pRegisterValues)))
}

802
tols_metric.go Normal file
View File

@@ -0,0 +1,802 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZetMetricGroupGet Retrieves metric group for a device.
///
/// @details
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pCount`
func ZetMetricGroupGet(
hDevice ZetDeviceHandle, // hDevice [in] handle of the device
pCount *uint32, // pCount [in,out] pointer to the number of metric groups. if count is zero, then the driver shall update the value with the total number of metric groups available. if count is greater than the number of metric groups available, then the driver shall update the value with the correct number of metric groups available.
phMetricGroups *ZetMetricGroupHandle, // phMetricGroups [in,out][optional][range(0, *pCount)] array of handle of metric groups. if count is less than the number of metric groups available, then driver shall only retrieve that number of metric groups.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupGet", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phMetricGroups)))
}
// ZET_MAX_METRIC_GROUP_NAME Maximum metric group name string size
const ZET_MAX_METRIC_GROUP_NAME = 256
// ZET_MAX_METRIC_GROUP_DESCRIPTION Maximum metric group description string size
const ZET_MAX_METRIC_GROUP_DESCRIPTION = 256
// ZetMetricGroupSamplingTypeFlags (zet_metric_group_sampling_type_flags_t) Metric group sampling type
type ZetMetricGroupSamplingTypeFlags uint32
const (
ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED ZetMetricGroupSamplingTypeFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED Event based sampling
ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED ZetMetricGroupSamplingTypeFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED Time based sampling
ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EXP_TRACER_BASED ZetMetricGroupSamplingTypeFlags = /* ZE_BIT(2) */(( 1 << 2 )) // ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EXP_TRACER_BASED Experimental Tracer based sampling
ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_FORCE_UINT32 ZetMetricGroupSamplingTypeFlags = 0x7fffffff // ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_FORCE_UINT32 Value marking end of ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_* ENUMs
)
// ZetMetricGroupProperties (zet_metric_group_properties_t) Metric group properties queried using ::zetMetricGroupGetProperties
type ZetMetricGroupProperties struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Name [ZET_MAX_METRIC_GROUP_NAME]byte // Name [out] metric group name
Description [ZET_MAX_METRIC_GROUP_DESCRIPTION]byte // Description [out] metric group description
Samplingtype ZetMetricGroupSamplingTypeFlags // Samplingtype [out] metric group sampling type. returns a combination of ::zet_metric_group_sampling_type_flag_t.
Domain uint32 // Domain [out] metric group domain number. Cannot use multiple, simultaneous metric groups from the same domain.
Metriccount uint32 // Metriccount [out] metric count belonging to this group
}
// ZetMetricGroupGetProperties Retrieves attributes of a metric group.
///
/// @details
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pProperties`
func ZetMetricGroupGetProperties(
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] handle of the metric group
pProperties *ZetMetricGroupProperties, // pProperties [in,out] metric group properties
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupGetProperties", uintptr(hMetricGroup), uintptr(unsafe.Pointer(pProperties)))
}
// ZetMetricType (zet_metric_type_t) Metric types
type ZetMetricType uintptr
const (
ZET_METRIC_TYPE_DURATION ZetMetricType = 0 // ZET_METRIC_TYPE_DURATION Metric type: duration
ZET_METRIC_TYPE_EVENT ZetMetricType = 1 // ZET_METRIC_TYPE_EVENT Metric type: event
ZET_METRIC_TYPE_EVENT_WITH_RANGE ZetMetricType = 2 // ZET_METRIC_TYPE_EVENT_WITH_RANGE Metric type: event with range
ZET_METRIC_TYPE_THROUGHPUT ZetMetricType = 3 // ZET_METRIC_TYPE_THROUGHPUT Metric type: throughput
ZET_METRIC_TYPE_TIMESTAMP ZetMetricType = 4 // ZET_METRIC_TYPE_TIMESTAMP Metric type: timestamp
ZET_METRIC_TYPE_FLAG ZetMetricType = 5 // ZET_METRIC_TYPE_FLAG Metric type: flag
ZET_METRIC_TYPE_RATIO ZetMetricType = 6 // ZET_METRIC_TYPE_RATIO Metric type: ratio
ZET_METRIC_TYPE_RAW ZetMetricType = 7 // ZET_METRIC_TYPE_RAW Metric type: raw
ZET_METRIC_TYPE_EVENT_EXP_TIMESTAMP ZetMetricType = 0x7ffffff9 // ZET_METRIC_TYPE_EVENT_EXP_TIMESTAMP Metric type: event with only timestamp and value has no meaning
ZET_METRIC_TYPE_EVENT_EXP_START ZetMetricType = 0x7ffffffa // ZET_METRIC_TYPE_EVENT_EXP_START Metric type: the first event of a start/end event pair
ZET_METRIC_TYPE_EVENT_EXP_END ZetMetricType = 0x7ffffffb // ZET_METRIC_TYPE_EVENT_EXP_END Metric type: the second event of a start/end event pair
ZET_METRIC_TYPE_EVENT_EXP_MONOTONIC_WRAPS_VALUE ZetMetricType = 0x7ffffffc // ZET_METRIC_TYPE_EVENT_EXP_MONOTONIC_WRAPS_VALUE Metric type: value of the event is a monotonically increasing value
///< that can wrap around
ZET_METRIC_TYPE_EXP_EXPORT_DMA_BUF ZetMetricType = 0x7ffffffd // ZET_METRIC_TYPE_EXP_EXPORT_DMA_BUF Metric which exports linux dma_buf, which could be imported/mapped to
///< the host process
ZET_METRIC_TYPE_IP_EXP ZetMetricType = 0x7ffffffe // ZET_METRIC_TYPE_IP_EXP Metric type: instruction pointer. Deprecated, use
///< ::ZET_METRIC_TYPE_IP.
ZET_METRIC_TYPE_IP ZetMetricType = 0x7ffffffe // ZET_METRIC_TYPE_IP Metric type: instruction pointer
ZET_METRIC_TYPE_FORCE_UINT32 ZetMetricType = 0x7fffffff // ZET_METRIC_TYPE_FORCE_UINT32 Value marking end of ZET_METRIC_TYPE_* ENUMs
)
// ZetMetricGroupCalculationType (zet_metric_group_calculation_type_t) Metric group calculation type
type ZetMetricGroupCalculationType uintptr
const (
ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES ZetMetricGroupCalculationType = 0 // ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES Calculated metric values from raw data.
ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES ZetMetricGroupCalculationType = 1 // ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES Maximum metric values.
ZET_METRIC_GROUP_CALCULATION_TYPE_FORCE_UINT32 ZetMetricGroupCalculationType = 0x7fffffff // ZET_METRIC_GROUP_CALCULATION_TYPE_FORCE_UINT32 Value marking end of ZET_METRIC_GROUP_CALCULATION_TYPE_* ENUMs
)
// ZetMetricGroupCalculateMetricValues Calculates metric values from raw data.
///
/// @details
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `::ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pRawData`
/// + `nullptr == pMetricValueCount`
func ZetMetricGroupCalculateMetricValues(
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] handle of the metric group
typ ZetMetricGroupCalculationType, // typ [in] calculation type to be applied on raw data
rawDataSize uintptr, // rawDataSize [in] size in bytes of raw data buffer
pRawData *uint8, // pRawData [in][range(0, rawDataSize)] buffer of raw data to calculate
pMetricValueCount *uint32, // pMetricValueCount [in,out] pointer to number of metric values calculated. if count is zero, then the driver shall update the value with the total number of metric values to be calculated. if count is greater than the number available in the raw data buffer, then the driver shall update the value with the actual number of metric values to be calculated.
pMetricValues *ZetTypedValue, // pMetricValues [in,out][optional][range(0, *pMetricValueCount)] buffer of calculated metrics. if count is less than the number available in the raw data buffer, then driver shall only calculate that number of metric values.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupCalculateMetricValues", uintptr(hMetricGroup), uintptr(typ), uintptr(rawDataSize), uintptr(unsafe.Pointer(pRawData)), uintptr(unsafe.Pointer(pMetricValueCount)), uintptr(unsafe.Pointer(pMetricValues)))
}
// ZetMetricGet Retrieves metric from a metric group.
///
/// @details
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pCount`
func ZetMetricGet(
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] handle of the metric group
pCount *uint32, // pCount [in,out] pointer to the number of metrics. if count is zero, then the driver shall update the value with the total number of metrics available. if count is greater than the number of metrics available, then the driver shall update the value with the correct number of metrics available.
phMetrics *ZetMetricHandle, // phMetrics [in,out][optional][range(0, *pCount)] array of handle of metrics. if count is less than the number of metrics available, then driver shall only retrieve that number of metrics.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGet", uintptr(hMetricGroup), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phMetrics)))
}
// ZET_MAX_METRIC_NAME Maximum metric name string size
const ZET_MAX_METRIC_NAME = 256
// ZET_MAX_METRIC_DESCRIPTION Maximum metric description string size
const ZET_MAX_METRIC_DESCRIPTION = 256
// ZET_MAX_METRIC_COMPONENT Maximum metric component string size
const ZET_MAX_METRIC_COMPONENT = 256
// ZET_MAX_METRIC_RESULT_UNITS Maximum metric result units string size
const ZET_MAX_METRIC_RESULT_UNITS = 256
// ZetMetricProperties (zet_metric_properties_t) Metric properties queried using ::zetMetricGetProperties
type ZetMetricProperties struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Name [ZET_MAX_METRIC_NAME]byte // Name [out] metric name
Description [ZET_MAX_METRIC_DESCRIPTION]byte // Description [out] metric description
Component [ZET_MAX_METRIC_COMPONENT]byte // Component [out] metric component
Tiernumber uint32 // Tiernumber [out] number of tier
Metrictype ZetMetricType // Metrictype [out] metric type
Resulttype ZetValueType // Resulttype [out] metric result type
Resultunits [ZET_MAX_METRIC_RESULT_UNITS]byte // Resultunits [out] metric result units
}
// ZetMetricGetProperties Retrieves attributes of a metric.
///
/// @details
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetric`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pProperties`
func ZetMetricGetProperties(
hMetric ZetMetricHandle, // hMetric [in] handle of the metric
pProperties *ZetMetricProperties, // pProperties [in,out] metric properties
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGetProperties", uintptr(hMetric), uintptr(unsafe.Pointer(pProperties)))
}
// ZetContextActivateMetricGroups Activates metric groups.
///
/// @details
/// - Immediately reconfigures the device to activate only those metric
/// groups provided.
/// - Any metric groups previously activated but not provided will be
/// deactivated.
/// - Deactivating metric groups that are still in-use will result in
/// undefined behavior.
/// - All metric groups must have different domains, see
/// ::zet_metric_group_properties_t.
/// - The application must **not** call this function from simultaneous
/// threads with the same device handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hContext`
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_SIZE
/// + `(nullptr == phMetricGroups) && (0 < count)`
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + Multiple metric groups share the same domain
func ZetContextActivateMetricGroups(
hContext ZetContextHandle, // hContext [in] handle of the context object
hDevice ZetDeviceHandle, // hDevice [in] handle of the device
count uint32, // count [in] metric group count to activate; must be 0 if `nullptr == phMetricGroups`
phMetricGroups *ZetMetricGroupHandle, // phMetricGroups [in][optional][range(0, count)] handles of the metric groups to activate. nullptr deactivates all previously used metric groups. all metrics groups must come from a different domains. metric query and metric stream must use activated metric groups.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetContextActivateMetricGroups", uintptr(hContext), uintptr(hDevice), uintptr(count), uintptr(unsafe.Pointer(phMetricGroups)))
}
// ZetMetricStreamerDesc (zet_metric_streamer_desc_t) Metric streamer descriptor
type ZetMetricStreamerDesc struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Notifyeverynreports uint32 // Notifyeverynreports [in,out] number of collected reports after which notification event will be signaled. If the requested value is not supported exactly, then the driver may use a value that is the closest supported approximation and shall update this member during ::zetMetricStreamerOpen.
Samplingperiod uint32 // Samplingperiod [in,out] streamer sampling period in nanoseconds. If the requested value is not supported exactly, then the driver may use a value that is the closest supported approximation and shall update this member during ::zetMetricStreamerOpen.
}
// ZetMetricStreamerOpen Opens metric streamer for a device.
///
/// @details
/// - The notification event must have been created from an event pool that
/// was created using ::ZE_EVENT_POOL_FLAG_HOST_VISIBLE flag.
/// - The duration of the signal event created from an event pool that was
/// created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined.
/// However, for consistency and orthogonality the event will report
/// correctly as signaled when used by other event API functionality.
/// - The application must **not** call this function from simultaneous
/// threads with the same device handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hContext`
/// + `nullptr == hDevice`
/// + `nullptr == hMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == desc`
/// + `nullptr == phMetricStreamer`
/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT
func ZetMetricStreamerOpen(
hContext ZetContextHandle, // hContext [in] handle of the context object
hDevice ZetDeviceHandle, // hDevice [in] handle of the device
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] handle of the metric group
desc *ZetMetricStreamerDesc, // desc [in,out] metric streamer descriptor
hNotificationEvent ZeEventHandle, // hNotificationEvent [in][optional] event used for report availability notification
phMetricStreamer *ZetMetricStreamerHandle, // phMetricStreamer [out] handle of metric streamer
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricStreamerOpen", uintptr(hContext), uintptr(hDevice), uintptr(hMetricGroup), uintptr(unsafe.Pointer(desc)), uintptr(hNotificationEvent), uintptr(unsafe.Pointer(phMetricStreamer)))
}
// ZetCommandListAppendMetricStreamerMarker Append metric streamer marker into a command list.
///
/// @details
/// - The application must ensure the metric streamer is accessible by the
/// device on which the command list was created.
/// - The application must ensure the command list and metric streamer were
/// created on the same context.
/// - The application must **not** call this function from simultaneous
/// threads with the same command list handle.
/// - Allow to associate metric stream time based metrics with executed
/// workload.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hCommandList`
/// + `nullptr == hMetricStreamer`
func ZetCommandListAppendMetricStreamerMarker(
hCommandList ZetCommandListHandle, // hCommandList [in] handle of the command list
hMetricStreamer ZetMetricStreamerHandle, // hMetricStreamer [in] handle of the metric streamer
value uint32, // value [in] streamer marker value
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetCommandListAppendMetricStreamerMarker", uintptr(hCommandList), uintptr(hMetricStreamer), uintptr(value))
}
// ZetMetricStreamerClose Closes metric streamer.
///
/// @details
/// - The application must **not** call this function from simultaneous
/// threads with the same metric streamer handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricStreamer`
func ZetMetricStreamerClose(
hMetricStreamer ZetMetricStreamerHandle, // hMetricStreamer [in][release] handle of the metric streamer
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricStreamerClose", uintptr(hMetricStreamer))
}
// ZetMetricStreamerReadData Reads data from metric streamer.
///
/// @details
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricStreamer`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pRawDataSize`
/// - ::ZE_RESULT_WARNING_DROPPED_DATA
/// + Metric streamer data may have been dropped. Reduce sampling period.
func ZetMetricStreamerReadData(
hMetricStreamer ZetMetricStreamerHandle, // hMetricStreamer [in] handle of the metric streamer
maxReportCount uint32, // maxReportCount [in] the maximum number of reports the application wants to receive. if `UINT32_MAX`, then function will retrieve all reports available
pRawDataSize *uintptr, // pRawDataSize [in,out] pointer to size in bytes of raw data requested to read. if size is zero, then the driver will update the value with the total size in bytes needed for all reports available. if size is non-zero, then driver will only retrieve the number of reports that fit into the buffer. if size is larger than size needed for all reports, then driver will update the value with the actual size needed.
pRawData *uint8, // pRawData [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer reports in raw format
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricStreamerReadData", uintptr(hMetricStreamer), uintptr(maxReportCount), uintptr(unsafe.Pointer(pRawDataSize)), uintptr(unsafe.Pointer(pRawData)))
}
// ZetMetricQueryPoolType (zet_metric_query_pool_type_t) Metric query pool types
type ZetMetricQueryPoolType uintptr
const (
ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE ZetMetricQueryPoolType = 0 // ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE Performance metric query pool.
ZET_METRIC_QUERY_POOL_TYPE_EXECUTION ZetMetricQueryPoolType = 1 // ZET_METRIC_QUERY_POOL_TYPE_EXECUTION Skips workload execution between begin/end calls.
ZET_METRIC_QUERY_POOL_TYPE_FORCE_UINT32 ZetMetricQueryPoolType = 0x7fffffff // ZET_METRIC_QUERY_POOL_TYPE_FORCE_UINT32 Value marking end of ZET_METRIC_QUERY_POOL_TYPE_* ENUMs
)
// ZetMetricQueryPoolDesc (zet_metric_query_pool_desc_t) Metric query pool description
type ZetMetricQueryPoolDesc struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Type ZetMetricQueryPoolType // Type [in] Query pool type.
Count uint32 // Count [in] Internal slots count within query pool object.
}
// ZetMetricQueryPoolCreate Creates a pool of metric queries on the context.
///
/// @details
/// - The application may call this function from simultaneous threads.
/// - The implementation of this function must be thread-safe.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hContext`
/// + `nullptr == hDevice`
/// + `nullptr == hMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == desc`
/// + `nullptr == phMetricQueryPool`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `::ZET_METRIC_QUERY_POOL_TYPE_EXECUTION < desc->type`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
func ZetMetricQueryPoolCreate(
hContext ZetContextHandle, // hContext [in] handle of the context object
hDevice ZetDeviceHandle, // hDevice [in] handle of the device
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] metric group associated with the query object.
desc *ZetMetricQueryPoolDesc, // desc [in] metric query pool descriptor
phMetricQueryPool *ZetMetricQueryPoolHandle, // phMetricQueryPool [out] handle of metric query pool
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricQueryPoolCreate", uintptr(hContext), uintptr(hDevice), uintptr(hMetricGroup), uintptr(unsafe.Pointer(desc)), uintptr(unsafe.Pointer(phMetricQueryPool)))
}
// ZetMetricQueryPoolDestroy Deletes a query pool object.
///
/// @details
/// - The application must destroy all query handles created from the pool
/// before destroying the pool itself.
/// - The application must ensure the device is not currently referencing
/// the any query within the pool before it is deleted.
/// - The application must **not** call this function from simultaneous
/// threads with the same query pool handle.
/// - The implementation of this function must be thread-safe.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricQueryPool`
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
func ZetMetricQueryPoolDestroy(
hMetricQueryPool ZetMetricQueryPoolHandle, // hMetricQueryPool [in][release] handle of the metric query pool
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricQueryPoolDestroy", uintptr(hMetricQueryPool))
}
// ZetMetricQueryCreate Creates metric query from the pool.
///
/// @details
/// - The application may call this function from simultaneous threads.
/// - The implementation of this function must be thread-safe.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricQueryPool`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == phMetricQuery`
func ZetMetricQueryCreate(
hMetricQueryPool ZetMetricQueryPoolHandle, // hMetricQueryPool [in] handle of the metric query pool
index uint32, // index [in] index of the query within the pool
phMetricQuery *ZetMetricQueryHandle, // phMetricQuery [out] handle of metric query
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricQueryCreate", uintptr(hMetricQueryPool), uintptr(index), uintptr(unsafe.Pointer(phMetricQuery)))
}
// ZetMetricQueryDestroy Deletes a metric query object.
///
/// @details
/// - The application must ensure the device is not currently referencing
/// the query before it is deleted.
/// - The application must **not** call this function from simultaneous
/// threads with the same query handle.
/// - The implementation of this function must be thread-safe.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricQuery`
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
func ZetMetricQueryDestroy(
hMetricQuery ZetMetricQueryHandle, // hMetricQuery [in][release] handle of metric query
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricQueryDestroy", uintptr(hMetricQuery))
}
// ZetMetricQueryReset Resets a metric query object back to initial state.
///
/// @details
/// - The application must ensure the device is not currently referencing
/// the query before it is reset
/// - The application must **not** call this function from simultaneous
/// threads with the same query handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricQuery`
func ZetMetricQueryReset(
hMetricQuery ZetMetricQueryHandle, // hMetricQuery [in] handle of metric query
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricQueryReset", uintptr(hMetricQuery))
}
// ZetCommandListAppendMetricQueryBegin Appends metric query begin into a command list.
///
/// @details
/// - The application must ensure the metric query is accessible by the
/// device on which the command list was created.
/// - The application must ensure the command list and metric query were
/// created on the same context.
/// - This command blocks all following commands from beginning until the
/// execution of the query completes.
/// - The application must **not** call this function from simultaneous
/// threads with the same command list handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hCommandList`
/// + `nullptr == hMetricQuery`
func ZetCommandListAppendMetricQueryBegin(
hCommandList ZetCommandListHandle, // hCommandList [in] handle of the command list
hMetricQuery ZetMetricQueryHandle, // hMetricQuery [in] handle of the metric query
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetCommandListAppendMetricQueryBegin", uintptr(hCommandList), uintptr(hMetricQuery))
}
// ZetCommandListAppendMetricQueryEnd Appends metric query end into a command list.
///
/// @details
/// - The application must ensure the metric query and events are accessible
/// by the device on which the command list was created.
/// - The application must ensure the command list, events and metric query
/// were created on the same context.
/// - The duration of the signal event created from an event pool that was
/// created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined.
/// However, for consistency and orthogonality the event will report
/// correctly as signaled when used by other event API functionality.
/// - If numWaitEvents is zero, then all previous commands are completed
/// prior to the execution of the query.
/// - If numWaitEvents is non-zero, then all phWaitEvents must be signaled
/// prior to the execution of the query.
/// - This command blocks all following commands from beginning until the
/// execution of the query completes.
/// - The application must **not** call this function from simultaneous
/// threads with the same command list handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hCommandList`
/// + `nullptr == hMetricQuery`
/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT
/// - ::ZE_RESULT_ERROR_INVALID_SIZE
/// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)`
func ZetCommandListAppendMetricQueryEnd(
hCommandList ZetCommandListHandle, // hCommandList [in] handle of the command list
hMetricQuery ZetMetricQueryHandle, // hMetricQuery [in] handle of the metric query
hSignalEvent ZeEventHandle, // hSignalEvent [in][optional] handle of the event to signal on completion
numWaitEvents uint32, // numWaitEvents [in] must be zero
phWaitEvents *ZeEventHandle, // phWaitEvents [in][mbz] must be nullptr
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetCommandListAppendMetricQueryEnd", uintptr(hCommandList), uintptr(hMetricQuery), uintptr(hSignalEvent), uintptr(numWaitEvents), uintptr(unsafe.Pointer(phWaitEvents)))
}
// ZetCommandListAppendMetricMemoryBarrier Appends metric query commands to flush all caches.
///
/// @details
/// - The application must **not** call this function from simultaneous
/// threads with the same command list handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hCommandList`
func ZetCommandListAppendMetricMemoryBarrier(
hCommandList ZetCommandListHandle, // hCommandList [in] handle of the command list
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetCommandListAppendMetricMemoryBarrier", uintptr(hCommandList))
}
// ZetMetricQueryGetData Retrieves raw data for a given metric query.
///
/// @details
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricQuery`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pRawDataSize`
func ZetMetricQueryGetData(
hMetricQuery ZetMetricQueryHandle, // hMetricQuery [in] handle of the metric query
pRawDataSize *uintptr, // pRawDataSize [in,out] pointer to size in bytes of raw data requested to read. if size is zero, then the driver will update the value with the total size in bytes needed for all reports available. if size is non-zero, then driver will only retrieve the number of reports that fit into the buffer. if size is larger than size needed for all reports, then driver will update the value with the actual size needed.
pRawData *uint8, // pRawData [in,out][optional][range(0, *pRawDataSize)] buffer containing query reports in raw format
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricQueryGetData", uintptr(hMetricQuery), uintptr(unsafe.Pointer(pRawDataSize)), uintptr(unsafe.Pointer(pRawData)))
}

137
tols_metricExportData.go Normal file
View File

@@ -0,0 +1,137 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZET_EXPORT_METRICS_DATA_EXP_NAME Exporting Metrics Data Experimental Extension Name
const ZET_EXPORT_METRICS_DATA_EXP_NAME = "ZET_experimental_metric_export_data"
// ZetExportMetricDataExpVersion (zet_export_metric_data_exp_version_t) Exporting Metrics Data Experimental Extension Version(s)
type ZetExportMetricDataExpVersion uintptr
const (
ZET_EXPORT_METRIC_DATA_EXP_VERSION_1_0 ZetExportMetricDataExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_EXPORT_METRIC_DATA_EXP_VERSION_1_0 version 1.0
ZET_EXPORT_METRIC_DATA_EXP_VERSION_CURRENT ZetExportMetricDataExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_EXPORT_METRIC_DATA_EXP_VERSION_CURRENT latest known version
ZET_EXPORT_METRIC_DATA_EXP_VERSION_FORCE_UINT32 ZetExportMetricDataExpVersion = 0x7fffffff // ZET_EXPORT_METRIC_DATA_EXP_VERSION_FORCE_UINT32 Value marking end of ZET_EXPORT_METRIC_DATA_EXP_VERSION_* ENUMs
)
// ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_NAME_EXP Maximum count of characters in export data element name
const ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_NAME_EXP = 256
// ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_DESCRIPTION_EXP Maximum export data element description string size
const ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_DESCRIPTION_EXP = 256
// ZetMetricCalculateExpDesc (zet_metric_calculate_exp_desc_t) Metrics calculation descriptor
type ZetMetricCalculateExpDesc struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Rawreportskipcount uint32 // Rawreportskipcount [in] number of reports to skip during calculation
}
// ZetMetricGroupGetExportDataExp Export Metrics Data for system independent calculation.
///
/// @details
/// - This function exports raw data and necessary information to perform
/// metrics calculation of collected data in a different system than where
/// data was collected, which may or may not have accelerators.
/// - Implementations can choose to describe the data arrangement of the
/// exported data, using any mechanism which allows users to read and
/// process them.
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pRawData`
/// + `nullptr == pExportDataSize`
func ZetMetricGroupGetExportDataExp(
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] handle of the metric group
pRawData *uint8, // pRawData [in] buffer of raw data
rawDataSize uintptr, // rawDataSize [in] size in bytes of raw data buffer
pExportDataSize *uintptr, // pExportDataSize [in,out] size in bytes of export data buffer if size is zero, then the driver shall update the value with the number of bytes necessary to store the exported data. if size is greater than required, then the driver shall update the value with the actual number of bytes necessary to store the exported data.
pExportData *uint8, // pExportData [in,out][optional][range(0, *pExportDataSize)] buffer of exported data.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupGetExportDataExp", uintptr(hMetricGroup), uintptr(unsafe.Pointer(pRawData)), uintptr(rawDataSize), uintptr(unsafe.Pointer(pExportDataSize)), uintptr(unsafe.Pointer(pExportData)))
}
// ZetMetricGroupCalculateMetricExportDataExp Calculate one or more sets of metric values from exported raw data.
///
/// @details
/// - Calculate metrics values using exported data returned by
/// ::zetMetricGroupGetExportDataExp.
/// - This function is similar to
/// ::zetMetricGroupCalculateMultipleMetricValuesExp except it would
/// calculate from exported metric data.
/// - This function could be used to calculate metrics on a system different
/// from where the metric raw data was collected.
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDriver`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `::ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pExportData`
/// + `nullptr == pCalculateDescriptor`
/// + `nullptr == pSetCount`
/// + `nullptr == pTotalMetricValueCount`
func ZetMetricGroupCalculateMetricExportDataExp(
hDriver ZeDriverHandle, // hDriver [in] handle of the driver instance
typ ZetMetricGroupCalculationType, // typ [in] calculation type to be applied on raw data
exportDataSize uintptr, // exportDataSize [in] size in bytes of exported data buffer
pExportData *uint8, // pExportData [in][range(0, exportDataSize)] buffer of exported data to calculate
pCalculateDescriptor *ZetMetricCalculateExpDesc, // pCalculateDescriptor [in] descriptor specifying calculation specific parameters
pSetCount *uint32, // pSetCount [in,out] pointer to number of metric sets. if count is zero, then the driver shall update the value with the total number of metric sets to be calculated. if count is greater than the number available in the raw data buffer, then the driver shall update the value with the actual number of metric sets to be calculated.
pTotalMetricValueCount *uint32, // pTotalMetricValueCount [in,out] pointer to number of the total number of metric values calculated, for all metric sets. if count is zero, then the driver shall update the value with the total number of metric values to be calculated. if count is greater than the number available in the raw data buffer, then the driver shall update the value with the actual number of metric values to be calculated.
pMetricCounts *uint32, // pMetricCounts [in,out][optional][range(0, *pSetCount)] buffer of metric counts per metric set.
pMetricValues *ZetTypedValue, // pMetricValues [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of calculated metrics. if count is less than the number available in the raw data buffer, then driver shall only calculate that number of metric values.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupCalculateMetricExportDataExp", uintptr(hDriver), uintptr(typ), uintptr(exportDataSize), uintptr(unsafe.Pointer(pExportData)), uintptr(unsafe.Pointer(pCalculateDescriptor)), uintptr(unsafe.Pointer(pSetCount)), uintptr(unsafe.Pointer(pTotalMetricValueCount)), uintptr(unsafe.Pointer(pMetricCounts)), uintptr(unsafe.Pointer(pMetricValues)))
}

View File

@@ -0,0 +1,53 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
)
// ZetMetricGroupTypeExpFlags (zet_metric_group_type_exp_flags_t) Metric group type
type ZetMetricGroupTypeExpFlags uint32
const (
ZET_METRIC_GROUP_TYPE_EXP_FLAG_EXPORT_DMA_BUF ZetMetricGroupTypeExpFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZET_METRIC_GROUP_TYPE_EXP_FLAG_EXPORT_DMA_BUF Metric group and metrics exports memory using linux dma-buf, which
///< could be imported/mapped to the host process. Properties of the
///< dma_buf could be queried using ::zet_export_dma_buf_exp_properties_t.
ZET_METRIC_GROUP_TYPE_EXP_FLAG_USER_CREATED ZetMetricGroupTypeExpFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZET_METRIC_GROUP_TYPE_EXP_FLAG_USER_CREATED Metric group created using ::zetDeviceCreateMetricGroupsFromMetricsExp
ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER ZetMetricGroupTypeExpFlags = /* ZE_BIT(2) */(( 1 << 2 )) // ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER Metric group which has a collection of metrics
ZET_METRIC_GROUP_TYPE_EXP_FLAG_MARKER ZetMetricGroupTypeExpFlags = /* ZE_BIT(3) */(( 1 << 3 )) // ZET_METRIC_GROUP_TYPE_EXP_FLAG_MARKER Metric group is capable of generating Marker metric
ZET_METRIC_GROUP_TYPE_EXP_FLAG_FORCE_UINT32 ZetMetricGroupTypeExpFlags = 0x7fffffff // ZET_METRIC_GROUP_TYPE_EXP_FLAG_FORCE_UINT32 Value marking end of ZET_METRIC_GROUP_TYPE_EXP_FLAG_* ENUMs
)
// ZetMetricGroupTypeExp (zet_metric_group_type_exp_t) Query the metric group type using `pNext` of
/// ::zet_metric_group_properties_t
type ZetMetricGroupTypeExp struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Type ZetMetricGroupTypeExpFlags // Type [out] metric group type. returns a combination of ::zet_metric_group_type_exp_flags_t.
}
// ZetExportDmaBufExpProperties (zet_export_dma_buf_exp_properties_t) Exported dma_buf properties queried using `pNext` of
/// ::zet_metric_group_properties_t or ::zet_metric_properties_t
type ZetExportDmaBufExpProperties struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Fd int32 // Fd [out] the file descriptor handle that could be used to import the memory by the host process.
Size uintptr // Size [out] size in bytes of the dma_buf
}

74
tols_metricGroupMarker.go Normal file
View File

@@ -0,0 +1,74 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZET_METRIC_GROUP_MARKER_EXP_NAME Marker Support Using MetricGroup Experimental Extension Name
const ZET_METRIC_GROUP_MARKER_EXP_NAME = "ZET_experimental_metric_group_marker"
// ZetMetricGroupMarkerExpVersion (zet_metric_group_marker_exp_version_t) Marker Support Using MetricGroup Experimental Extension Version(s)
type ZetMetricGroupMarkerExpVersion uintptr
const (
ZET_METRIC_GROUP_MARKER_EXP_VERSION_1_0 ZetMetricGroupMarkerExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_METRIC_GROUP_MARKER_EXP_VERSION_1_0 version 1.0
ZET_METRIC_GROUP_MARKER_EXP_VERSION_CURRENT ZetMetricGroupMarkerExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_METRIC_GROUP_MARKER_EXP_VERSION_CURRENT latest known version
ZET_METRIC_GROUP_MARKER_EXP_VERSION_FORCE_UINT32 ZetMetricGroupMarkerExpVersion = 0x7fffffff // ZET_METRIC_GROUP_MARKER_EXP_VERSION_FORCE_UINT32 Value marking end of ZET_METRIC_GROUP_MARKER_EXP_VERSION_* ENUMs
)
// ZetMetricSourceIdExp (zet_metric_source_id_exp_t) Query the metric source unique identifier using `pNext` of
/// ::zet_metric_group_properties_t
type ZetMetricSourceIdExp struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Sourceid uint32 // Sourceid [out] unique number representing the Metric Source.
}
// ZetCommandListAppendMarkerExp Append a Marker based on the Metric source of the Metric Group, to a
/// Command List.
///
/// @details
/// - This function appends a Marker based on the Metric source of the
/// Metric Group, to Command List.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hCommandList`
/// + `nullptr == hMetricGroup`
func ZetCommandListAppendMarkerExp(
hCommandList ZetCommandListHandle, // hCommandList [in] handle to the command list
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] handle to the marker metric group. ::zet_metric_group_type_exp_flags_t could be used to check whether marker is supoported by the metric group.
value uint32, // value [in] marker value
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetCommandListAppendMarkerExp", uintptr(hCommandList), uintptr(hMetricGroup), uintptr(value))
}

641
tols_metricProgrammable.go Normal file
View File

@@ -0,0 +1,641 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZET_PROGRAMMABLE_METRICS_EXP_NAME Programmable Metrics Experimental Extension Name
const ZET_PROGRAMMABLE_METRICS_EXP_NAME = "ZET_experimental_programmable_metrics"
// ZetMetricProgrammableExpVersion (zet_metric_programmable_exp_version_t) Programmable Metrics Experimental Extension Version(s)
type ZetMetricProgrammableExpVersion uintptr
const (
ZET_METRIC_PROGRAMMABLE_EXP_VERSION_1_1 ZetMetricProgrammableExpVersion = /* ZE_MAKE_VERSION( 1, 1 ) */((( 1 << 16 )|( 1 & 0x0000ffff))) // ZET_METRIC_PROGRAMMABLE_EXP_VERSION_1_1 version 1.1
ZET_METRIC_PROGRAMMABLE_EXP_VERSION_CURRENT ZetMetricProgrammableExpVersion = /* ZE_MAKE_VERSION( 1, 1 ) */((( 1 << 16 )|( 1 & 0x0000ffff))) // ZET_METRIC_PROGRAMMABLE_EXP_VERSION_CURRENT latest known version
ZET_METRIC_PROGRAMMABLE_EXP_VERSION_FORCE_UINT32 ZetMetricProgrammableExpVersion = 0x7fffffff // ZET_METRIC_PROGRAMMABLE_EXP_VERSION_FORCE_UINT32 Value marking end of ZET_METRIC_PROGRAMMABLE_EXP_VERSION_* ENUMs
)
// ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_NAME_EXP Maximum count of characters in export data element name
const ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_NAME_EXP = 256
// ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_DESCRIPTION_EXP Maximum export data element description string size
const ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_DESCRIPTION_EXP = 256
// ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP Maximum count of characters in metric group name prefix
const ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP = 64
// ZET_MAX_METRIC_PROGRAMMABLE_NAME_EXP Maximum metric programmable name string size
const ZET_MAX_METRIC_PROGRAMMABLE_NAME_EXP = 128
// ZET_MAX_METRIC_PROGRAMMABLE_DESCRIPTION_EXP Maximum metric programmable description string size
const ZET_MAX_METRIC_PROGRAMMABLE_DESCRIPTION_EXP = 128
// ZET_MAX_METRIC_PROGRAMMABLE_COMPONENT_EXP Maximum metric programmable component string size
const ZET_MAX_METRIC_PROGRAMMABLE_COMPONENT_EXP = 128
// ZET_MAX_METRIC_PROGRAMMABLE_PARAMETER_NAME_EXP Maximum metric programmable parameter string size
const ZET_MAX_METRIC_PROGRAMMABLE_PARAMETER_NAME_EXP = 128
// ZET_MAX_METRIC_PROGRAMMABLE_VALUE_DESCRIPTION_EXP Maximum value for programmable value description
const ZET_MAX_METRIC_PROGRAMMABLE_VALUE_DESCRIPTION_EXP = 128
// ZE_MAX_METRIC_GROUP_NAME_PREFIX Maximum value metric group name prefix
const ZE_MAX_METRIC_GROUP_NAME_PREFIX = 64
// ZetMetricProgrammableExpHandle (zet_metric_programmable_exp_handle_t) Handle of metric programmable's object
type ZetMetricProgrammableExpHandle uintptr
// ZetMetricProgrammableExpProperties (zet_metric_programmable_exp_properties_t) Metric Programmable properties queried using
/// ::zetMetricProgrammableGetPropertiesExp
type ZetMetricProgrammableExpProperties struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Name [ZET_MAX_METRIC_PROGRAMMABLE_NAME_EXP]byte // Name [out] metric programmable name
Description [ZET_MAX_METRIC_PROGRAMMABLE_DESCRIPTION_EXP]byte // Description [out] metric programmable description
Component [ZET_MAX_METRIC_PROGRAMMABLE_COMPONENT_EXP]byte // Component [out] metric programmable component
Tiernumber uint32 // Tiernumber [out] tier number
Domain uint32 // Domain [out] metric domain number.
Parametercount uint32 // Parametercount [out] number of parameters in the programmable
Samplingtype ZetMetricGroupSamplingTypeFlags // Samplingtype [out] metric sampling type. returns a combination of ::zet_metric_group_sampling_type_flag_t.
Sourceid uint32 // Sourceid [out] unique metric source identifier(within platform)to identify the HW block where the metric is collected.
}
// ZetMetricProgrammableParamTypeExp (zet_metric_programmable_param_type_exp_t) Metric Programmable Parameter types
type ZetMetricProgrammableParamTypeExp uintptr
const (
ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_DISAGGREGATION ZetMetricProgrammableParamTypeExp = 0 // ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_DISAGGREGATION Metric is disaggregated.
ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_LATENCY ZetMetricProgrammableParamTypeExp = 1 // ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_LATENCY Metric for latency measurement.
ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_UTILIZATION ZetMetricProgrammableParamTypeExp = 2 // ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_UTILIZATION Produces normalization in percent using raw_metric * 100 / cycles / HW
///< instance_count.
ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_AVERAGE ZetMetricProgrammableParamTypeExp = 3 // ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_AVERAGE Produces normalization using raw_metric / HW instance_count.
ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_RATE ZetMetricProgrammableParamTypeExp = 4 // ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_RATE Produces normalization average using raw_metric / timestamp.
ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_BYTES ZetMetricProgrammableParamTypeExp = 5 // ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_BYTES Produces normalization average using raw_metric * n bytes.
ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_GENERIC ZetMetricProgrammableParamTypeExp = 6 // ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_GENERIC Generic Parameter type. Please refer the parameter's description.
ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_FORCE_UINT32 ZetMetricProgrammableParamTypeExp = 0x7fffffff // ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_FORCE_UINT32 Value marking end of ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_* ENUMs
)
// ZetValueInfoTypeExp (zet_value_info_type_exp_t) Supported value info types
type ZetValueInfoTypeExp uintptr
const (
ZET_VALUE_INFO_TYPE_EXP_UINT32 ZetValueInfoTypeExp = 0 // ZET_VALUE_INFO_TYPE_EXP_UINT32 32-bit unsigned-integer
ZET_VALUE_INFO_TYPE_EXP_UINT64 ZetValueInfoTypeExp = 1 // ZET_VALUE_INFO_TYPE_EXP_UINT64 64-bit unsigned-integer
ZET_VALUE_INFO_TYPE_EXP_FLOAT32 ZetValueInfoTypeExp = 2 // ZET_VALUE_INFO_TYPE_EXP_FLOAT32 32-bit floating-point
ZET_VALUE_INFO_TYPE_EXP_FLOAT64 ZetValueInfoTypeExp = 3 // ZET_VALUE_INFO_TYPE_EXP_FLOAT64 64-bit floating-point
ZET_VALUE_INFO_TYPE_EXP_BOOL8 ZetValueInfoTypeExp = 4 // ZET_VALUE_INFO_TYPE_EXP_BOOL8 8-bit boolean
ZET_VALUE_INFO_TYPE_EXP_UINT8 ZetValueInfoTypeExp = 5 // ZET_VALUE_INFO_TYPE_EXP_UINT8 8-bit unsigned-integer
ZET_VALUE_INFO_TYPE_EXP_UINT16 ZetValueInfoTypeExp = 6 // ZET_VALUE_INFO_TYPE_EXP_UINT16 16-bit unsigned-integer
ZET_VALUE_INFO_TYPE_EXP_UINT64_RANGE ZetValueInfoTypeExp = 7 // ZET_VALUE_INFO_TYPE_EXP_UINT64_RANGE 64-bit unsigned-integer range (minimum and maximum)
ZET_VALUE_INFO_TYPE_EXP_FLOAT64_RANGE ZetValueInfoTypeExp = 8 // ZET_VALUE_INFO_TYPE_EXP_FLOAT64_RANGE 64-bit floating point range (minimum and maximum)
ZET_VALUE_INFO_TYPE_EXP_FORCE_UINT32 ZetValueInfoTypeExp = 0x7fffffff // ZET_VALUE_INFO_TYPE_EXP_FORCE_UINT32 Value marking end of ZET_VALUE_INFO_TYPE_EXP_* ENUMs
)
// ZetValueUint64RangeExp (zet_value_uint64_range_exp_t) Value info of type uint64_t range
type ZetValueUint64RangeExp struct {
Ui64min uint64 // Ui64min [out] minimum value of the range
Ui64max uint64 // Ui64max [out] maximum value of the range
}
// ZetValueFp64RangeExp (zet_value_fp64_range_exp_t) Value info of type float64 range
type ZetValueFp64RangeExp struct {
Fp64min float64 // Fp64min [out] minimum value of the range
Fp64max float64 // Fp64max [out] maximum value of the range
}
// ZetValueInfoExp (zet_value_info_exp_t) Union of value information
type ZetValueInfoExp [16]byte
// ZetMetricProgrammableParamInfoExp (zet_metric_programmable_param_info_exp_t) Metric Programmable parameter information
type ZetMetricProgrammableParamInfoExp struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Type ZetMetricProgrammableParamTypeExp // Type [out] programmable parameter type
Name [ZET_MAX_METRIC_PROGRAMMABLE_PARAMETER_NAME_EXP]byte // Name [out] metric programmable parameter name
Valueinfotype ZetValueInfoTypeExp // Valueinfotype [out] value info type
Defaultvalue ZetValue // Defaultvalue [out] default value for the parameter
Valueinfocount uint32 // Valueinfocount [out] count of ::zet_metric_programmable_param_value_info_exp_t
}
// ZetMetricProgrammableParamValueInfoExp (zet_metric_programmable_param_value_info_exp_t) Metric Programmable parameter value information
type ZetMetricProgrammableParamValueInfoExp struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Valueinfo ZetValueInfoExp // Valueinfo [out] information about the parameter value
Description [ZET_MAX_METRIC_PROGRAMMABLE_VALUE_DESCRIPTION_EXP]byte // Description [out] description about the value
}
// ZetMetricProgrammableParamValueExp (zet_metric_programmable_param_value_exp_t) Metric Programmable parameter value
type ZetMetricProgrammableParamValueExp struct {
Value ZetValue // Value [in] parameter value
}
// ZetMetricProgrammableGetExp Query and get the available metric programmable handles.
///
/// @details
/// - Query the available programmable handles using *pCount = 0.
/// - Returns all programmable metric handles available in the device.
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pCount`
func ZetMetricProgrammableGetExp(
hDevice ZetDeviceHandle, // hDevice [in] handle of the device
pCount *uint32, // pCount [in,out] pointer to the number of metric programmable handles. if count is zero, then the driver shall update the value with the total number of metric programmable handles available. if count is greater than the number of metric programmable handles available, then the driver shall update the value with the correct number of metric programmable handles available.
phMetricProgrammables *ZetMetricProgrammableExpHandle, // phMetricProgrammables [in,out][optional][range(0, *pCount)] array of handle of metric programmables. if count is less than the number of metric programmables available, then driver shall only retrieve that number of metric programmables.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricProgrammableGetExp", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phMetricProgrammables)))
}
// ZetMetricProgrammableGetPropertiesExp Get the properties of the metric programmable.
///
/// @details
/// - Returns the properties of the metric programmable.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricProgrammable`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pProperties`
func ZetMetricProgrammableGetPropertiesExp(
hMetricProgrammable ZetMetricProgrammableExpHandle, // hMetricProgrammable [in] handle of the metric programmable
pProperties *ZetMetricProgrammableExpProperties, // pProperties [in,out] properties of the metric programmable
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricProgrammableGetPropertiesExp", uintptr(hMetricProgrammable), uintptr(unsafe.Pointer(pProperties)))
}
// ZetMetricProgrammableGetParamInfoExp Get the information about the parameters of the metric programmable.
///
/// @details
/// - Returns information about the parameters of the metric programmable
/// handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricProgrammable`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pParameterCount`
/// + `nullptr == pParameterInfo`
func ZetMetricProgrammableGetParamInfoExp(
hMetricProgrammable ZetMetricProgrammableExpHandle, // hMetricProgrammable [in] handle of the metric programmable
pParameterCount *uint32, // pParameterCount [in,out] count of the parameters to retrieve parameter info. if value pParameterCount is greater than count of parameters available, then pParameterCount will be updated with count of parameters available. The count of parameters available can be queried using ::zetMetricProgrammableGetPropertiesExp.
pParameterInfo *ZetMetricProgrammableParamInfoExp, // pParameterInfo [in,out][range(1, *pParameterCount)] array of parameter info. if parameterCount is less than the number of parameters available, then driver shall only retrieve that number of parameter info.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricProgrammableGetParamInfoExp", uintptr(hMetricProgrammable), uintptr(unsafe.Pointer(pParameterCount)), uintptr(unsafe.Pointer(pParameterInfo)))
}
// ZetMetricProgrammableGetParamValueInfoExp Get the information about the parameter value of the metric
/// programmable.
///
/// @details
/// - Returns the value-information about the parameter at the specific
/// ordinal of the metric programmable handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricProgrammable`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pValueInfoCount`
/// + `nullptr == pValueInfo`
func ZetMetricProgrammableGetParamValueInfoExp(
hMetricProgrammable ZetMetricProgrammableExpHandle, // hMetricProgrammable [in] handle of the metric programmable
parameterOrdinal uint32, // parameterOrdinal [in] ordinal of the parameter in the metric programmable
pValueInfoCount *uint32, // pValueInfoCount [in,out] count of parameter value information to retrieve. if value at pValueInfoCount is greater than count of value info available, then pValueInfoCount will be updated with count of value info available. The count of parameter value info available can be queried using ::zetMetricProgrammableGetParamInfoExp.
pValueInfo *ZetMetricProgrammableParamValueInfoExp, // pValueInfo [in,out][range(1, *pValueInfoCount)] array of parameter value info. if pValueInfoCount is less than the number of value info available, then driver shall only retrieve that number of value info.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricProgrammableGetParamValueInfoExp", uintptr(hMetricProgrammable), uintptr(parameterOrdinal), uintptr(unsafe.Pointer(pValueInfoCount)), uintptr(unsafe.Pointer(pValueInfo)))
}
// ZetMetricCreateFromProgrammableExp2 Create metric handles by applying parameter values on the metric
/// programmable handle.
///
/// @details
/// - Multiple parameter values could be used to prepare a metric.
/// - If parameterCount = 0, the default value of the metric programmable
/// would be used for all parameters.
/// - The implementation can post-fix a C string to the metric name and
/// description, based on the parameter values chosen.
/// - ::zetMetricProgrammableGetParamInfoExp() returns a list of parameters
/// in a defined order.
/// - Therefore, the list of values passed in to the API should respect the
/// same order such that the desired parameter is set with expected value
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricProgrammable`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pParameterValues`
/// + `nullptr == pName`
/// + `nullptr == pDescription`
/// + `nullptr == pMetricHandleCount`
func ZetMetricCreateFromProgrammableExp2(
hMetricProgrammable ZetMetricProgrammableExpHandle, // hMetricProgrammable [in] handle of the metric programmable
parameterCount uint32, // parameterCount [in] Count of parameters to set.
pParameterValues *ZetMetricProgrammableParamValueExp, // pParameterValues [in] list of parameter values to be set.
pName *byte, // pName [in] pointer to metric name to be used. Must point to a null-terminated character array no longer than ::ZET_MAX_METRIC_NAME.
pDescription *byte, // pDescription [in] pointer to metric description to be used. Must point to a null-terminated character array no longer than ::ZET_MAX_METRIC_DESCRIPTION.
pMetricHandleCount *uint32, // pMetricHandleCount [in,out] Pointer to the number of metric handles. if count is zero, then the driver shall update the value with the number of metric handles available for this programmable. if count is greater than the number of metric handles available, then the driver shall update the value with the correct number of metric handles available.
phMetricHandles *ZetMetricHandle, // phMetricHandles [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. if count is less than the number of metrics available, then driver shall only retrieve that number of metric handles.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricCreateFromProgrammableExp2", uintptr(hMetricProgrammable), uintptr(parameterCount), uintptr(unsafe.Pointer(pParameterValues)), uintptr(unsafe.Pointer(pName)), uintptr(unsafe.Pointer(pDescription)), uintptr(unsafe.Pointer(pMetricHandleCount)), uintptr(unsafe.Pointer(phMetricHandles)))
}
// ZetMetricCreateFromProgrammableExp Create metric handles by applying parameter values on the metric
/// programmable handle.
///
/// @details
/// - This API is deprecated. Please use
/// ::zetMetricCreateFromProgrammableExp2()
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricProgrammable`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pParameterValues`
/// + `nullptr == pName`
/// + `nullptr == pDescription`
/// + `nullptr == pMetricHandleCount`
func ZetMetricCreateFromProgrammableExp(
hMetricProgrammable ZetMetricProgrammableExpHandle, // hMetricProgrammable [in] handle of the metric programmable
pParameterValues *ZetMetricProgrammableParamValueExp, // pParameterValues [in] list of parameter values to be set.
parameterCount uint32, // parameterCount [in] Count of parameters to set.
pName *byte, // pName [in] pointer to metric name to be used. Must point to a null-terminated character array no longer than ::ZET_MAX_METRIC_NAME.
pDescription *byte, // pDescription [in] pointer to metric description to be used. Must point to a null-terminated character array no longer than ::ZET_MAX_METRIC_DESCRIPTION.
pMetricHandleCount *uint32, // pMetricHandleCount [in,out] Pointer to the number of metric handles. if count is zero, then the driver shall update the value with the number of metric handles available for this programmable. if count is greater than the number of metric handles available, then the driver shall update the value with the correct number of metric handles available.
phMetricHandles *ZetMetricHandle, // phMetricHandles [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. if count is less than the number of metrics available, then driver shall only retrieve that number of metric handles.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricCreateFromProgrammableExp", uintptr(hMetricProgrammable), uintptr(unsafe.Pointer(pParameterValues)), uintptr(parameterCount), uintptr(unsafe.Pointer(pName)), uintptr(unsafe.Pointer(pDescription)), uintptr(unsafe.Pointer(pMetricHandleCount)), uintptr(unsafe.Pointer(phMetricHandles)))
}
// ZetDeviceCreateMetricGroupsFromMetricsExp Create multiple metric group handles from metric handles.
///
/// @details
/// - Creates multiple metric groups from metrics which were created using
/// ::zetMetricCreateFromProgrammableExp2().
/// - Metrics whose Hardware resources do not overlap are added to same
/// metric group.
/// - The metric groups created using this API are managed by the
/// application and cannot be retrieved using ::zetMetricGroupGet().
/// - The created metric groups are ready for activation and collection.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + metricGroupCount is lesser than the number of metric group handles that could be created.
func ZetDeviceCreateMetricGroupsFromMetricsExp(
hDevice ZetDeviceHandle, // hDevice [in] handle of the device.
metricCount uint32, // metricCount [in] number of metric handles.
phMetrics *ZetMetricHandle, // phMetrics [in] metric handles to be added to the metric groups.
pMetricGroupNamePrefix *byte, // pMetricGroupNamePrefix [in] prefix to the name created for the metric groups. Must point to a null-terminated character array no longer than ::ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP.
pDescription *byte, // pDescription [in] pointer to description of the metric groups. Must point to a null-terminated character array no longer than ::ZET_MAX_METRIC_GROUP_DESCRIPTION.
pMetricGroupCount *uint32, // pMetricGroupCount [in,out] pointer to the number of metric group handles to be created. if pMetricGroupCount is zero, then the driver shall update the value with the maximum possible number of metric group handles that could be created. if pMetricGroupCount is greater than the number of metric group handles that could be created, then the driver shall update the value with the correct number of metric group handles generated. if pMetricGroupCount is lesser than the number of metric group handles that could be created, then ::ZE_RESULT_ERROR_INVALID_ARGUMENT is returned.
phMetricGroup *ZetMetricGroupHandle, // phMetricGroup [in,out][optional][range(0, *pMetricGroupCount)] array of handle of metric group handles. Created Metric group handles.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDeviceCreateMetricGroupsFromMetricsExp", uintptr(hDevice), uintptr(metricCount), uintptr(unsafe.Pointer(phMetrics)), uintptr(unsafe.Pointer(pMetricGroupNamePrefix)), uintptr(unsafe.Pointer(pDescription)), uintptr(unsafe.Pointer(pMetricGroupCount)), uintptr(unsafe.Pointer(phMetricGroup)))
}
// ZetMetricGroupCreateExp Create metric group handle.
///
/// @details
/// - This API is deprecated. Please use
/// ::zetDeviceCreateMetricGroupsFromMetricsExp
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pName`
/// + `nullptr == pDescription`
/// + `nullptr == phMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `0x7 < samplingType`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
func ZetMetricGroupCreateExp(
hDevice ZetDeviceHandle, // hDevice [in] handle of the device
pName *byte, // pName [in] pointer to metric group name. Must point to a null-terminated character array no longer than ::ZET_MAX_METRIC_GROUP_NAME.
pDescription *byte, // pDescription [in] pointer to metric group description. Must point to a null-terminated character array no longer than ::ZET_MAX_METRIC_GROUP_DESCRIPTION.
samplingType ZetMetricGroupSamplingTypeFlags, // samplingType [in] Sampling type for the metric group.
phMetricGroup *ZetMetricGroupHandle, // phMetricGroup [in,out] Created Metric group handle
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupCreateExp", uintptr(hDevice), uintptr(unsafe.Pointer(pName)), uintptr(unsafe.Pointer(pDescription)), uintptr(samplingType), uintptr(unsafe.Pointer(phMetricGroup)))
}
// ZetMetricGroupAddMetricExp Add a metric handle to the metric group handle created using
/// ::zetDeviceCreateMetricGroupsFromMetricsExp.
///
/// @details
/// - Reasons for failing to add the metric could be queried using
/// pErrorString
/// - Multiple additions of same metric would add the metric only once to
/// the hMetricGroup
/// - Metric handles from multiple domains may be used in a single metric
/// group.
/// - Metric handles from different sourceIds (refer
/// ::zet_metric_programmable_exp_properties_t) are not allowed in a
/// single metric group.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricGroup`
/// + `nullptr == hMetric`
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + If a Metric handle from a pre-defined metric group is requested to be added.
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
/// + If the metric group is currently activated.
func ZetMetricGroupAddMetricExp(
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] Handle of the metric group
hMetric ZetMetricHandle, // hMetric [in] Metric to be added to the group.
pErrorStringSize *uintptr, // pErrorStringSize [in,out][optional] Size of the error string to query, if an error was reported during adding the metric handle. if *pErrorStringSize is zero, then the driver shall update the value with the size of the error string in bytes.
pErrorString *byte, // pErrorString [in,out][optional][range(0, *pErrorStringSize)] Error string. if *pErrorStringSize is less than the length of the error string available, then driver shall only retrieve that length of error string.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupAddMetricExp", uintptr(hMetricGroup), uintptr(hMetric), uintptr(unsafe.Pointer(pErrorStringSize)), uintptr(unsafe.Pointer(pErrorString)))
}
// ZetMetricGroupRemoveMetricExp Remove a metric from the metric group handle created using
/// ::zetDeviceCreateMetricGroupsFromMetricsExp.
///
/// @details
/// - Remove an already added metric handle from the metric group.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricGroup`
/// + `nullptr == hMetric`
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + If trying to remove a metric not previously added to the metric group
/// + If the input metric group is a pre-defined metric group
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
/// + If the metric group is currently activated
func ZetMetricGroupRemoveMetricExp(
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] Handle of the metric group
hMetric ZetMetricHandle, // hMetric [in] Metric handle to be removed from the metric group.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupRemoveMetricExp", uintptr(hMetricGroup), uintptr(hMetric))
}
// ZetMetricGroupCloseExp Closes a created metric group using
/// ::zetDeviceCreateMetricGroupsFromMetricsExp, so that it can be
/// activated.
///
/// @details
/// - Finalizes the ::zetMetricGroupAddMetricExp and
/// ::zetMetricGroupRemoveMetricExp operations on the metric group.
/// - This is a necessary step before activation of the created metric
/// group.
/// - Add / Remove of metrics is possible after ::zetMetricGroupCloseExp.
/// However, a call to ::zetMetricGroupCloseExp is necessary after
/// modifying the metric group.
/// - Implementations could choose to add new metrics to the group during
/// ::zetMetricGroupCloseExp, which are related and might add value to the
/// metrics already added by the application
/// - Applications can query the list of metrics in the metric group using
/// ::zetMetricGet
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + If the input metric group is a pre-defined metric group
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
/// + If the metric group is currently activated
func ZetMetricGroupCloseExp(
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] Handle of the metric group
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupCloseExp", uintptr(hMetricGroup))
}
// ZetMetricGroupDestroyExp Destroy a metric group created using
/// ::zetDeviceCreateMetricGroupsFromMetricsExp.
///
/// @details
/// - Metric handles created using ::zetMetricCreateFromProgrammableExp2 and
/// are part of the metricGroup are not destroyed.
/// - It is necessary to call ::zetMetricDestroyExp for each of the metric
/// handles (created from ::zetMetricCreateFromProgrammableExp2) to
/// destroy them.
/// - It is not necessary to remove the metrics in the metricGroup before
/// destroying it.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + If trying to destroy a pre-defined metric group
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
/// + If trying to destroy an activated metric group
func ZetMetricGroupDestroyExp(
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] Handle of the metric group to destroy
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupDestroyExp", uintptr(hMetricGroup))
}
// ZetMetricDestroyExp Destroy a metric created using ::zetMetricCreateFromProgrammableExp2.
///
/// @details
/// - If a metric is added to a metric group, the metric has to be removed
/// using ::zetMetricGroupRemoveMetricExp before it can be destroyed.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetric`
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + If trying to destroy a metric from pre-defined metric group
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
/// + If trying to destroy a metric currently added to a metric group
func ZetMetricDestroyExp(
hMetric ZetMetricHandle, // hMetric [in] Handle of the metric to destroy
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricDestroyExp", uintptr(hMetric))
}

View File

@@ -0,0 +1,102 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"github.com/fumiama/gozel/internal/zecall"
)
// ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_NAME Runtime Enabling and Disabling Metrics Extension Name
const ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_NAME = "ZET_experimental_metrics_runtime_enable_disable"
// ZetMetricsRuntimeEnableDisableExpVersion (zet_metrics_runtime_enable_disable_exp_version_t) Runtime Enabling and Disabling Metrics Extension Version(s)
type ZetMetricsRuntimeEnableDisableExpVersion uintptr
const (
ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_1_0 ZetMetricsRuntimeEnableDisableExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_1_0 version 1.0
ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_CURRENT ZetMetricsRuntimeEnableDisableExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_CURRENT latest known version
ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_FORCE_UINT32 ZetMetricsRuntimeEnableDisableExpVersion = 0x7fffffff // ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_FORCE_UINT32 Value marking end of ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_* ENUMs
)
// ZetDeviceEnableMetricsExp Enable Metrics collection during runtime.
///
/// @details
/// - This API enables metric collection for a device/sub-device if not
/// already enabled.
/// - if ZET_ENABLE_METRICS=1 was already set, then calling this api would
/// be a NOP.
/// - This api should be called after calling zeInit().
/// - If device is a root-device handle, then its sub-devices are also
/// enabled.
/// - ::zetDeviceDisableMetricsExp need not be called if if this api returns
/// error.
/// - This API can be used as runtime alternative to setting
/// ZET_ENABLE_METRICS=1.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
func ZetDeviceEnableMetricsExp(
hDevice ZetDeviceHandle, // hDevice [in] handle of the device where metrics collection has to be enabled.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDeviceEnableMetricsExp", uintptr(hDevice))
}
// ZetDeviceDisableMetricsExp Disable Metrics collection during runtime, if it was already enabled.
///
/// @details
/// - This API disables metrics collection for a device/sub-device, if it
/// was previously enabled.
/// - If device is a root-device handle, then its sub-devices are also
/// disabled.
/// - The application has to ensure that all metric operations are complete
/// and all metric resources are released before this API is called.
/// - If there are metric operations in progress or metric resources are not
/// released, then ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE is returned.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hDevice`
func ZetDeviceDisableMetricsExp(
hDevice ZetDeviceHandle, // hDevice [in] handle of the device where metrics collection has to be disabled
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetDeviceDisableMetricsExp", uintptr(hDevice))
}

362
tols_metricTracer.go Normal file
View File

@@ -0,0 +1,362 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZET_METRICS_TRACER_EXP_NAME Metric Tracer Experimental Extension Name
const ZET_METRICS_TRACER_EXP_NAME = "ZET_experimental_metric_tracer"
// ZetMetricTracerExpVersion (zet_metric_tracer_exp_version_t) Metric Tracer Experimental Extension Version(s)
type ZetMetricTracerExpVersion uintptr
const (
ZET_METRIC_TRACER_EXP_VERSION_1_0 ZetMetricTracerExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_METRIC_TRACER_EXP_VERSION_1_0 version 1.0
ZET_METRIC_TRACER_EXP_VERSION_CURRENT ZetMetricTracerExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_METRIC_TRACER_EXP_VERSION_CURRENT latest known version
ZET_METRIC_TRACER_EXP_VERSION_FORCE_UINT32 ZetMetricTracerExpVersion = 0x7fffffff // ZET_METRIC_TRACER_EXP_VERSION_FORCE_UINT32 Value marking end of ZET_METRIC_TRACER_EXP_VERSION_* ENUMs
)
// ZetMetricTracerExpHandle (zet_metric_tracer_exp_handle_t) Handle of metric tracer's object
type ZetMetricTracerExpHandle uintptr
// ZetMetricDecoderExpHandle (zet_metric_decoder_exp_handle_t) Handle of metric decoder's object
type ZetMetricDecoderExpHandle uintptr
// ZetMetricTracerExpDesc (zet_metric_tracer_exp_desc_t) Metric tracer descriptor
type ZetMetricTracerExpDesc struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Notifyeverynbytes uint32 // Notifyeverynbytes [in,out] number of collected bytes after which notification event will be signaled. If the requested value is not supported exactly, then the driver may use a value that is the closest supported approximation and shall update this member during ::zetMetricTracerCreateExp.
}
// ZetMetricEntryExp (zet_metric_entry_exp_t) Decoded metric entry
type ZetMetricEntryExp struct {
Value ZetValue // Value [out] value of the decodable metric entry or event. Number is meaningful based on the metric type.
Timestamp uint64 // Timestamp [out] timestamp at which the event happened.
Metricindex uint32 // Metricindex [out] index to the decodable metric handle in the input array (phMetric) in ::zetMetricTracerDecodeExp().
Onsubdevice ZeBool // Onsubdevice [out] True if the event occurred on a sub-device; false means the device on which the metric tracer was opened does not have sub-devices.
Subdeviceid uint32 // Subdeviceid [out] If onSubdevice is true, this gives the ID of the sub-device.
}
// ZetMetricTracerCreateExp Create a metric tracer for a device.
///
/// @details
/// - The notification event must have been created from an event pool that
/// was created using ::ZE_EVENT_POOL_FLAG_HOST_VISIBLE flag.
/// - The duration of the signal event created from an event pool that was
/// created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined.
/// However, for consistency and orthogonality the event will report
/// correctly as signaled when used by other event API functionality.
/// - The application must **not** call this function from simultaneous
/// threads with the same device handle.
/// - The metric tracer is created in disabled state
/// - Metric groups must support sampling type
/// ZET_METRIC_SAMPLING_TYPE_EXP_FLAG_TRACER_BASED
/// - All metric groups must be first activated
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hContext`
/// + `nullptr == hDevice`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == phMetricGroups`
/// + `nullptr == desc`
/// + `nullptr == phMetricTracer`
/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT
func ZetMetricTracerCreateExp(
hContext ZetContextHandle, // hContext [in] handle of the context object
hDevice ZetDeviceHandle, // hDevice [in] handle of the device
metricGroupCount uint32, // metricGroupCount [in] metric group count
phMetricGroups *ZetMetricGroupHandle, // phMetricGroups [in][range(0, metricGroupCount )] handles of the metric groups to trace
desc *ZetMetricTracerExpDesc, // desc [in,out] metric tracer descriptor
hNotificationEvent ZeEventHandle, // hNotificationEvent [in][optional] event used for report availability notification. Note: If buffer is not drained when the event it flagged, there is a risk of HW event buffer being overrun
phMetricTracer *ZetMetricTracerExpHandle, // phMetricTracer [out] handle of the metric tracer
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricTracerCreateExp", uintptr(hContext), uintptr(hDevice), uintptr(metricGroupCount), uintptr(unsafe.Pointer(phMetricGroups)), uintptr(unsafe.Pointer(desc)), uintptr(hNotificationEvent), uintptr(unsafe.Pointer(phMetricTracer)))
}
// ZetMetricTracerDestroyExp Destroy a metric tracer.
///
/// @details
/// - The application must **not** call this function from simultaneous
/// threads with the same metric tracer handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricTracer`
func ZetMetricTracerDestroyExp(
hMetricTracer ZetMetricTracerExpHandle, // hMetricTracer [in] handle of the metric tracer
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricTracerDestroyExp", uintptr(hMetricTracer))
}
// ZetMetricTracerEnableExp Start events collection
///
/// @details
/// - Driver implementations must make this API call have as minimal
/// overhead as possible, to allow applications start/stop event
/// collection at any point during execution
/// - The application must **not** call this function from simultaneous
/// threads with the same metric tracer handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricTracer`
func ZetMetricTracerEnableExp(
hMetricTracer ZetMetricTracerExpHandle, // hMetricTracer [in] handle of the metric tracer
synchronous ZeBool, // synchronous [in] request synchronous behavior. Confirmation of successful asynchronous operation is done by calling ::zetMetricTracerReadDataExp() and checking the return status: ::ZE_RESULT_NOT_READY will be returned when the tracer is inactive. ::ZE_RESULT_SUCCESS will be returned when the tracer is active.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricTracerEnableExp", uintptr(hMetricTracer), uintptr(synchronous))
}
// ZetMetricTracerDisableExp Stop events collection
///
/// @details
/// - Driver implementations must make this API call have as minimal
/// overhead as possible, to allow applications start/stop event
/// collection at any point during execution
/// - The application must **not** call this function from simultaneous
/// threads with the same metric tracer handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricTracer`
func ZetMetricTracerDisableExp(
hMetricTracer ZetMetricTracerExpHandle, // hMetricTracer [in] handle of the metric tracer
synchronous ZeBool, // synchronous [in] request synchronous behavior. Confirmation of successful asynchronous operation is done by calling ::zetMetricTracerReadDataExp() and checking the return status: ::ZE_RESULT_SUCCESS will be returned when the tracer is active or when it is inactive but still has data. ::ZE_RESULT_NOT_READY will be returned when the tracer is inactive and has no more data to be retrieved.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricTracerDisableExp", uintptr(hMetricTracer), uintptr(synchronous))
}
// ZetMetricTracerReadDataExp Read data from the metric tracer
///
/// @details
/// - The application must **not** call this function from simultaneous
/// threads with the same metric tracer handle.
/// - Data can be retrieved after tracer is disabled. When buffers are
/// drained ::ZE_RESULT_NOT_READY will be returned
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricTracer`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pRawDataSize`
/// - ::ZE_RESULT_WARNING_DROPPED_DATA
/// + Metric tracer data may have been dropped.
/// - ::ZE_RESULT_NOT_READY
/// + Metric tracer is disabled and no data is available to read.
func ZetMetricTracerReadDataExp(
hMetricTracer ZetMetricTracerExpHandle, // hMetricTracer [in] handle of the metric tracer
pRawDataSize *uintptr, // pRawDataSize [in,out] pointer to size in bytes of raw data requested to read. if size is zero, then the driver will update the value with the total size in bytes needed for all data available. if size is non-zero, then driver will only retrieve that amount of data. if size is larger than size needed for all data, then driver will update the value with the actual size needed.
pRawData *uint8, // pRawData [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer data in raw format
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricTracerReadDataExp", uintptr(hMetricTracer), uintptr(unsafe.Pointer(pRawDataSize)), uintptr(unsafe.Pointer(pRawData)))
}
// ZetMetricDecoderCreateExp Create a metric decoder for a given metric tracer.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricTracer`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == phMetricDecoder`
func ZetMetricDecoderCreateExp(
hMetricTracer ZetMetricTracerExpHandle, // hMetricTracer [in] handle of the metric tracer
phMetricDecoder *ZetMetricDecoderExpHandle, // phMetricDecoder [out] handle of the metric decoder object
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricDecoderCreateExp", uintptr(hMetricTracer), uintptr(unsafe.Pointer(phMetricDecoder)))
}
// ZetMetricDecoderDestroyExp Destroy a metric decoder.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == phMetricDecoder`
func ZetMetricDecoderDestroyExp(
phMetricDecoder ZetMetricDecoderExpHandle, // phMetricDecoder [in] handle of the metric decoder object
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricDecoderDestroyExp", uintptr(phMetricDecoder))
}
// ZetMetricDecoderGetDecodableMetricsExp Return the list of the decodable metrics from the decoder.
///
/// @details
/// - The decodable metrics handles returned by this API are defined by the
/// metric groups in the tracer on which the decoder was created.
/// - The decodable metrics handles returned by this API are only valid to
/// decode metrics raw data with ::zetMetricTracerDecodeExp(). Decodable
/// metric handles are not valid to compare with metrics handles included
/// in metric groups.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricDecoder`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pCount`
/// + `nullptr == phMetrics`
func ZetMetricDecoderGetDecodableMetricsExp(
hMetricDecoder ZetMetricDecoderExpHandle, // hMetricDecoder [in] handle of the metric decoder object
pCount *uint32, // pCount [in,out] pointer to number of decodable metric in the hMetricDecoder handle. If count is zero, then the driver shall update the value with the total number of decodable metrics available in the decoder. if count is greater than zero but less than the total number of decodable metrics available in the decoder, then only that number will be returned. if count is greater than the number of decodable metrics available in the decoder, then the driver shall update the value with the actual number of decodable metrics available.
phMetrics *ZetMetricHandle, // phMetrics [in,out] [range(0, *pCount)] array of handles of decodable metrics in the hMetricDecoder handle provided.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricDecoderGetDecodableMetricsExp", uintptr(hMetricDecoder), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phMetrics)))
}
// ZetMetricTracerDecodeExp Decode raw events collected from a tracer.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == phMetricDecoder`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pRawDataSize`
/// + `nullptr == phMetrics`
/// + `nullptr == pSetCount`
/// + `nullptr == pMetricEntriesCount`
func ZetMetricTracerDecodeExp(
phMetricDecoder ZetMetricDecoderExpHandle, // phMetricDecoder [in] handle of the metric decoder object
pRawDataSize *uintptr, // pRawDataSize [in,out] size in bytes of raw data buffer. If pMetricEntriesCount is greater than zero but less than total number of decodable metrics available in the raw data buffer, then driver shall update this value with actual number of raw data bytes processed.
pRawData *uint8, // pRawData [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer data in raw format
metricsCount uint32, // metricsCount [in] number of decodable metrics in the tracer for which the hMetricDecoder handle was provided. See ::zetMetricDecoderGetDecodableMetricsExp(). If metricCount is greater than zero but less than the number decodable metrics available in the raw data buffer, then driver shall only decode those.
phMetrics *ZetMetricHandle, // phMetrics [in] [range(0, metricsCount)] array of handles of decodable metrics in the decoder for which the hMetricDecoder handle was provided. Metrics handles are expected to be for decodable metrics, see ::zetMetricDecoderGetDecodableMetricsExp()
pSetCount *uint32, // pSetCount [in,out] pointer to number of metric sets. If count is zero, then the driver shall update the value with the total number of metric sets to be decoded. If count is greater than the number available in the raw data buffer, then the driver shall update the value with the actual number of metric sets to be decoded. There is a 1:1 relation between the number of sets and sub-devices returned in the decoded entries.
pMetricEntriesCountPerSet *uint32, // pMetricEntriesCountPerSet [in,out][optional][range(0, *pSetCount)] buffer of metric entries counts per metric set, one value per set.
pMetricEntriesCount *uint32, // pMetricEntriesCount [in,out] pointer to the total number of metric entries decoded, for all metric sets. If count is zero, then the driver shall update the value with the total number of metric entries to be decoded. If count is greater than zero but less than the total number of metric entries available in the raw data, then user provided number will be decoded. If count is greater than the number available in the raw data buffer, then the driver shall update the value with the actual number of decodable metric entries decoded. If set to null, then driver will only update the value of pSetCount.
pMetricEntries *ZetMetricEntryExp, // pMetricEntries [in,out][optional][range(0, *pMetricEntriesCount)] buffer containing decoded metric entries
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricTracerDecodeExp", uintptr(phMetricDecoder), uintptr(unsafe.Pointer(pRawDataSize)), uintptr(unsafe.Pointer(pRawData)), uintptr(metricsCount), uintptr(unsafe.Pointer(phMetrics)), uintptr(unsafe.Pointer(pSetCount)), uintptr(unsafe.Pointer(pMetricEntriesCountPerSet)), uintptr(unsafe.Pointer(pMetricEntriesCount)), uintptr(unsafe.Pointer(pMetricEntries)))
}

69
tols_module.go Normal file
View File

@@ -0,0 +1,69 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZetModuleDebugInfoFormat (zet_module_debug_info_format_t) Supported module debug info formats.
type ZetModuleDebugInfoFormat uintptr
const (
ZET_MODULE_DEBUG_INFO_FORMAT_ELF_DWARF ZetModuleDebugInfoFormat = 0 // ZET_MODULE_DEBUG_INFO_FORMAT_ELF_DWARF Format is ELF/DWARF
ZET_MODULE_DEBUG_INFO_FORMAT_FORCE_UINT32 ZetModuleDebugInfoFormat = 0x7fffffff // ZET_MODULE_DEBUG_INFO_FORMAT_FORCE_UINT32 Value marking end of ZET_MODULE_DEBUG_INFO_FORMAT_* ENUMs
)
// ZetModuleGetDebugInfo Retrieve debug info from module.
///
/// @details
/// - The caller can pass nullptr for pDebugInfo when querying only for
/// size.
/// - The implementation will copy the native binary into a buffer supplied
/// by the caller.
/// - The application may call this function from simultaneous threads.
/// - The implementation of this function should be lock-free.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hModule`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `::ZET_MODULE_DEBUG_INFO_FORMAT_ELF_DWARF < format`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pSize`
func ZetModuleGetDebugInfo(
hModule ZetModuleHandle, // hModule [in] handle of the module
format ZetModuleDebugInfoFormat, // format [in] debug info format requested
pSize *uintptr, // pSize [in,out] size of debug info in bytes
pDebugInfo *uint8, // pDebugInfo [in,out][optional] byte pointer to debug info
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetModuleGetDebugInfo", uintptr(hModule), uintptr(format), uintptr(unsafe.Pointer(pSize)), uintptr(unsafe.Pointer(pDebugInfo)))
}

82
tols_multiMetricValues.go Normal file
View File

@@ -0,0 +1,82 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZET_MULTI_METRICS_EXP_NAME Calculating Multiple Metrics Experimental Extension Name
const ZET_MULTI_METRICS_EXP_NAME = "ZET_experimental_calculate_multiple_metrics"
// ZeCalculateMultipleMetricsExpVersion (ze_calculate_multiple_metrics_exp_version_t) Calculating Multiple Metrics Experimental Extension Version(s)
type ZeCalculateMultipleMetricsExpVersion uintptr
const (
ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_1_0 ZeCalculateMultipleMetricsExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_1_0 version 1.0
ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_CURRENT ZeCalculateMultipleMetricsExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_CURRENT latest known version
ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_FORCE_UINT32 ZeCalculateMultipleMetricsExpVersion = 0x7fffffff // ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_FORCE_UINT32 Value marking end of ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_* ENUMs
)
// ZetMetricGroupCalculateMultipleMetricValuesExp Calculate one or more sets of metric values from raw data.
///
/// @details
/// - This function is similar to ::zetMetricGroupCalculateMetricValues
/// except it may calculate more than one set of metric values from a
/// single data buffer. There may be one set of metric values for each
/// sub-device, for example.
/// - Each set of metric values may consist of a different number of metric
/// values, returned as the metric value count.
/// - All metric values are calculated into a single buffer; use the metric
/// counts to determine which metric values belong to which set.
/// - The application may call this function from simultaneous threads.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hMetricGroup`
/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION
/// + `::ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type`
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pRawData`
/// + `nullptr == pSetCount`
/// + `nullptr == pTotalMetricValueCount`
func ZetMetricGroupCalculateMultipleMetricValuesExp(
hMetricGroup ZetMetricGroupHandle, // hMetricGroup [in] handle of the metric group
typ ZetMetricGroupCalculationType, // typ [in] calculation type to be applied on raw data
rawDataSize uintptr, // rawDataSize [in] size in bytes of raw data buffer
pRawData *uint8, // pRawData [in][range(0, rawDataSize)] buffer of raw data to calculate
pSetCount *uint32, // pSetCount [in,out] pointer to number of metric sets. if count is zero, then the driver shall update the value with the total number of metric sets to be calculated. if count is greater than the number available in the raw data buffer, then the driver shall update the value with the actual number of metric sets to be calculated.
pTotalMetricValueCount *uint32, // pTotalMetricValueCount [in,out] pointer to number of the total number of metric values calculated, for all metric sets. if count is zero, then the driver shall update the value with the total number of metric values to be calculated. if count is greater than the number available in the raw data buffer, then the driver shall update the value with the actual number of metric values to be calculated.
pMetricCounts *uint32, // pMetricCounts [in,out][optional][range(0, *pSetCount)] buffer of metric counts per metric set.
pMetricValues *ZetTypedValue, // pMetricValues [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of calculated metrics. if count is less than the number available in the raw data buffer, then driver shall only calculate that number of metric values.
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetMetricGroupCalculateMultipleMetricValuesExp", uintptr(hMetricGroup), uintptr(typ), uintptr(rawDataSize), uintptr(unsafe.Pointer(pRawData)), uintptr(unsafe.Pointer(pSetCount)), uintptr(unsafe.Pointer(pTotalMetricValueCount)), uintptr(unsafe.Pointer(pMetricCounts)), uintptr(unsafe.Pointer(pMetricValues)))
}

102
tols_pin.go Normal file
View File

@@ -0,0 +1,102 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZetProfileFlags (zet_profile_flags_t) Supportted profile features
type ZetProfileFlags uint32
const (
ZET_PROFILE_FLAG_REGISTER_REALLOCATION ZetProfileFlags = /* ZE_BIT(0) */(( 1 << 0 )) // ZET_PROFILE_FLAG_REGISTER_REALLOCATION request the compiler attempt to minimize register usage as much as
///< possible to allow for instrumentation
ZET_PROFILE_FLAG_FREE_REGISTER_INFO ZetProfileFlags = /* ZE_BIT(1) */(( 1 << 1 )) // ZET_PROFILE_FLAG_FREE_REGISTER_INFO request the compiler generate free register info
ZET_PROFILE_FLAG_FORCE_UINT32 ZetProfileFlags = 0x7fffffff // ZET_PROFILE_FLAG_FORCE_UINT32 Value marking end of ZET_PROFILE_FLAG_* ENUMs
)
// ZetProfileProperties (zet_profile_properties_t) Profiling meta-data for instrumentation
type ZetProfileProperties struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Flags ZetProfileFlags // Flags [out] indicates which flags were enabled during compilation. returns 0 (none) or a combination of ::zet_profile_flag_t
Numtokens uint32 // Numtokens [out] number of tokens immediately following this structure
}
// ZetProfileTokenType (zet_profile_token_type_t) Supported profile token types
type ZetProfileTokenType uintptr
const (
ZET_PROFILE_TOKEN_TYPE_FREE_REGISTER ZetProfileTokenType = 0 // ZET_PROFILE_TOKEN_TYPE_FREE_REGISTER GRF info
ZET_PROFILE_TOKEN_TYPE_FORCE_UINT32 ZetProfileTokenType = 0x7fffffff // ZET_PROFILE_TOKEN_TYPE_FORCE_UINT32 Value marking end of ZET_PROFILE_TOKEN_TYPE_* ENUMs
)
// ZetProfileFreeRegisterToken (zet_profile_free_register_token_t) Profile free register token detailing unused registers in the current
/// function
type ZetProfileFreeRegisterToken struct {
Type ZetProfileTokenType // Type [out] type of token
Size uint32 // Size [out] total size of the token, in bytes
Count uint32 // Count [out] number of register sequences immediately following this structure
}
// ZetProfileRegisterSequence (zet_profile_register_sequence_t) Profile register sequence detailing consecutive bytes, all of which
/// are unused
type ZetProfileRegisterSequence struct {
Start uint32 // Start [out] starting byte in the register table, representing the start of unused bytes in the current function
Count uint32 // Count [out] number of consecutive bytes in the sequence, starting from start
}
// ZetKernelGetProfileInfo Retrieve profiling information generated for the kernel.
///
/// @details
/// - Module must be created using the following build option:
/// + "-zet-profile-flags <n>" - enable generation of profile
/// information
/// + "<n>" must be a combination of ::zet_profile_flag_t, in hex
/// - The application may call this function from simultaneous threads.
/// - The implementation of this function should be lock-free.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hKernel`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pProfileProperties`
func ZetKernelGetProfileInfo(
hKernel ZetKernelHandle, // hKernel [in] handle to kernel
pProfileProperties *ZetProfileProperties, // pProfileProperties [out] pointer to profile properties
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetKernelGetProfileInfo", uintptr(hKernel), uintptr(unsafe.Pointer(pProfileProperties)))
}

230
tols_tracing.go Normal file
View File

@@ -0,0 +1,230 @@
// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.15-r1.15.31
*
*/
package gozel
import (
"unsafe"
"github.com/fumiama/gozel/internal/zecall"
)
// ZET_API_TRACING_EXP_NAME API Tracing Experimental Extension Name
const ZET_API_TRACING_EXP_NAME = "ZET_experimental_api_tracing"
// ZetApiTracingExpVersion (zet_api_tracing_exp_version_t) API Tracing Experimental Extension Version(s)
type ZetApiTracingExpVersion uintptr
const (
ZET_API_TRACING_EXP_VERSION_1_0 ZetApiTracingExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_API_TRACING_EXP_VERSION_1_0 version 1.0
ZET_API_TRACING_EXP_VERSION_CURRENT ZetApiTracingExpVersion = /* ZE_MAKE_VERSION( 1, 0 ) */((( 1 << 16 )|( 0 & 0x0000ffff))) // ZET_API_TRACING_EXP_VERSION_CURRENT latest known version
ZET_API_TRACING_EXP_VERSION_FORCE_UINT32 ZetApiTracingExpVersion = 0x7fffffff // ZET_API_TRACING_EXP_VERSION_FORCE_UINT32 Value marking end of ZET_API_TRACING_EXP_VERSION_* ENUMs
)
// ZetCoreCallbacks (zet_core_callbacks_t) Alias the existing callbacks definition for 'core' callbacks
type ZetCoreCallbacks ZeCallbacks
// ZetTracerExpDesc (zet_tracer_exp_desc_t) Tracer descriptor
type ZetTracerExpDesc struct {
Stype ZetStructureType // Stype [in] type of this structure
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
Puserdata unsafe.Pointer // Puserdata [in] pointer passed to every tracer's callbacks
}
// ZetTracerExpCreate Creates a tracer on the context.
///
/// @details
/// - @deprecated This function is not supported in L0 drivers and has been
/// replaced by the Loader Tracing Layer. See the Loader Tracing
/// documentation for more details.
/// - The application must only use the tracer for the context which was
/// provided during creation.
/// - The tracer is created in the disabled state.
/// - The application may call this function from simultaneous threads.
/// - The implementation of this function must be thread-safe.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hContext`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == desc`
/// + `nullptr == desc->pUserData`
/// + `nullptr == phTracer`
func ZetTracerExpCreate(
hContext ZetContextHandle, // hContext [in] handle of the context object
desc *ZetTracerExpDesc, // desc [in] pointer to tracer descriptor
phTracer *ZetTracerExpHandle, // phTracer [out] pointer to handle of tracer object created
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetTracerExpCreate", uintptr(hContext), uintptr(unsafe.Pointer(desc)), uintptr(unsafe.Pointer(phTracer)))
}
// ZetTracerExpDestroy Destroys a tracer.
///
/// @details
/// - @deprecated This function is not supported in L0 drivers and has been
/// replaced by the Loader Tracing Layer. See the Loader Tracing
/// documentation for more details.
/// - The application must **not** call this function from simultaneous
/// threads with the same tracer handle.
/// - The implementation of this function must be thread-safe.
/// - The implementation of this function will stall and wait on any
/// outstanding threads executing callbacks before freeing any Host
/// allocations associated with this tracer.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hTracer`
/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE
func ZetTracerExpDestroy(
hTracer ZetTracerExpHandle, // hTracer [in][release] handle of tracer object to destroy
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetTracerExpDestroy", uintptr(hTracer))
}
// ZetTracerExpSetPrologues Sets the collection of callbacks to be executed **before** driver
/// execution.
///
/// @details
/// - @deprecated This function is not supported in L0 drivers and has been
/// replaced by the Loader Tracing Layer. See the Loader Tracing
/// documentation for more details.
/// - The application only needs to set the function pointers it is
/// interested in receiving; all others should be 'nullptr'
/// - The application must ensure that no other threads are executing
/// functions for which the tracing functions are changing.
/// - The application must **not** call this function from simultaneous
/// threads with the same tracer handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hTracer`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pCoreCbs`
func ZetTracerExpSetPrologues(
hTracer ZetTracerExpHandle, // hTracer [in] handle of the tracer
pCoreCbs *ZetCoreCallbacks, // pCoreCbs [in] pointer to table of 'core' callback function pointers
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetTracerExpSetPrologues", uintptr(hTracer), uintptr(unsafe.Pointer(pCoreCbs)))
}
// ZetTracerExpSetEpilogues Sets the collection of callbacks to be executed **after** driver
/// execution.
///
/// @details
/// - @deprecated This function is not supported in L0 drivers and has been
/// replaced by the Loader Tracing Layer. See the Loader Tracing
/// documentation for more details.
/// - The application only needs to set the function pointers it is
/// interested in receiving; all others should be 'nullptr'
/// - The application must ensure that no other threads are executing
/// functions for which the tracing functions are changing.
/// - The application must **not** call this function from simultaneous
/// threads with the same tracer handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hTracer`
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// + `nullptr == pCoreCbs`
func ZetTracerExpSetEpilogues(
hTracer ZetTracerExpHandle, // hTracer [in] handle of the tracer
pCoreCbs *ZetCoreCallbacks, // pCoreCbs [in] pointer to table of 'core' callback function pointers
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetTracerExpSetEpilogues", uintptr(hTracer), uintptr(unsafe.Pointer(pCoreCbs)))
}
// ZetTracerExpSetEnabled Enables (or disables) the tracer
///
/// @details
/// - @deprecated This function is not supported in L0 drivers and has been
/// replaced by the Loader Tracing Layer. See the Loader Tracing
/// documentation for more details.
/// - The application must **not** call this function from simultaneous
/// threads with the same tracer handle.
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE
/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
/// - ::ZE_RESULT_ERROR_UNKNOWN
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `nullptr == hTracer`
func ZetTracerExpSetEnabled(
hTracer ZetTracerExpHandle, // hTracer [in] handle of the tracer
enable ZeBool, // enable [in] enable the tracer if true; disable if false
) (ZeResult, error) {
return zecall.Call[ZeResult]("zetTracerExpSetEnabled", uintptr(hTracer), uintptr(enable))
}

View File

@@ -2,6 +2,7 @@ package ze
import (
"math"
"runtime"
"unsafe"
"github.com/fumiama/gozel"
@@ -11,11 +12,11 @@ import (
type CommandQueueHandle gozel.ZeCommandQueueHandle
// CommandQueueCreate creates a command queue on the given device with default mode and normal priority.
func (h ContextHandle) CommandQueueCreate(hDevice gozel.ZeDeviceHandle) (
func (h ContextHandle) CommandQueueCreate(hDevice DeviceHandle) (
CommandQueueHandle, error,
) {
var q gozel.ZeCommandQueueHandle
_, err := gozel.ZeCommandQueueCreate(gozel.ZeContextHandle(h), hDevice, &gozel.ZeCommandQueueDesc{
_, err := gozel.ZeCommandQueueCreate(gozel.ZeContextHandle(h), gozel.ZeDeviceHandle(hDevice), &gozel.ZeCommandQueueDesc{
Stype: gozel.ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC,
Mode: gozel.ZE_COMMAND_QUEUE_MODE_DEFAULT,
Priority: gozel.ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
@@ -24,9 +25,12 @@ func (h ContextHandle) CommandQueueCreate(hDevice gozel.ZeDeviceHandle) (
}
// ExecuteCommandLists submits the command list for execution on the command queue.
func (h CommandQueueHandle) ExecuteCommandLists(hCommandList CommandListHandle) error {
cl := gozel.ZeCommandListHandle(hCommandList)
_, err := gozel.ZeCommandQueueExecuteCommandLists(gozel.ZeCommandQueueHandle(h), 1, &cl, 0)
func (h CommandQueueHandle) ExecuteCommandLists(hCommandList ...CommandListHandle) error {
_, err := gozel.ZeCommandQueueExecuteCommandLists(
gozel.ZeCommandQueueHandle(h), uint32(len(hCommandList)),
(*gozel.ZeCommandListHandle)(&hCommandList[0]), 0,
)
runtime.KeepAlive(hCommandList)
return err
}
@@ -46,11 +50,11 @@ func (h CommandQueueHandle) Destroy() error {
type CommandListHandle gozel.ZeCommandListHandle
// CommandListCreate creates a command list on the given device.
func (h ContextHandle) CommandListCreate(hDevice gozel.ZeDeviceHandle) (
func (h ContextHandle) CommandListCreate(hDevice DeviceHandle) (
CommandListHandle, error,
) {
var cl gozel.ZeCommandListHandle
_, err := gozel.ZeCommandListCreate(gozel.ZeContextHandle(h), hDevice, &gozel.ZeCommandListDesc{
_, err := gozel.ZeCommandListCreate(gozel.ZeContextHandle(h), gozel.ZeDeviceHandle(hDevice), &gozel.ZeCommandListDesc{
Stype: gozel.ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC,
}, &cl)
return CommandListHandle(cl), err

View File

@@ -2,8 +2,11 @@ package ze
import "github.com/fumiama/gozel"
// DeviceHandle is a handle to a Level Zero driver's device object.
type DeviceHandle gozel.ZeDeviceHandle
// DeviceGet retrieves all devices within the driver.
func (h DriverHandle) DeviceGet() ([]gozel.ZeDeviceHandle, error) {
func (h DriverHandle) DeviceGet() ([]DeviceHandle, error) {
var count uint32
_, err := gozel.ZeDeviceGet(gozel.ZeDriverHandle(h), &count, nil)
if err != nil {
@@ -12,10 +15,24 @@ func (h DriverHandle) DeviceGet() ([]gozel.ZeDeviceHandle, error) {
if count == 0 {
return nil, nil
}
devices := make([]gozel.ZeDeviceHandle, count)
_, err = gozel.ZeDeviceGet(gozel.ZeDriverHandle(h), &count, &devices[0])
devices := make([]DeviceHandle, count)
_, err = gozel.ZeDeviceGet(gozel.ZeDriverHandle(h), &count, (*gozel.ZeDeviceHandle)(&devices[0]))
if err != nil {
return nil, err
}
return devices, nil
}
// DeviceGetProperties retrieves properties of the device.
func (h DeviceHandle) DeviceGetProperties() (prop gozel.ZeDeviceProperties, err error) {
prop.Stype = gozel.ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES
_, err = gozel.ZeDeviceGetProperties(gozel.ZeDeviceHandle(h), &prop)
return
}
// DeviceGetComputeProperties retrieves compute properties of the device.
func (h DeviceHandle) DeviceGetComputeProperties() (prop gozel.ZeDeviceComputeProperties, err error) {
prop.Stype = gozel.ZE_STRUCTURE_TYPE_DEVICE_COMPUTE_PROPERTIES
_, err = gozel.ZeDeviceGetComputeProperties(gozel.ZeDeviceHandle(h), &prop)
return
}

View File

@@ -7,13 +7,13 @@ import (
)
// MemAllocDevice allocates device memory on the given device with the specified size and alignment.
func (h ContextHandle) MemAllocDevice(hDevice gozel.ZeDeviceHandle, size uintptr, alignment uintptr) (
func (h ContextHandle) MemAllocDevice(hDevice DeviceHandle, size uintptr, alignment uintptr) (
unsafe.Pointer, error,
) {
var p unsafe.Pointer
_, err := gozel.ZeMemAllocDevice(gozel.ZeContextHandle(h), &gozel.ZeDeviceMemAllocDesc{
Stype: gozel.ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC,
}, size, alignment, hDevice, &p)
}, size, alignment, gozel.ZeDeviceHandle(hDevice), &p)
return p, err
}

View File

@@ -12,14 +12,14 @@ import (
type ModuleHandle gozel.ZeModuleHandle
// ModuleCreate creates a module from SPIR-V binary data on the given device.
func (h ContextHandle) ModuleCreate(hDevice gozel.ZeDeviceHandle, data []byte) (
func (h ContextHandle) ModuleCreate(hDevice DeviceHandle, data []byte) (
ModuleHandle, error,
) {
var (
m gozel.ZeModuleHandle
lg gozel.ZeModuleBuildLogHandle
)
_, err := gozel.ZeModuleCreate(gozel.ZeContextHandle(h), hDevice, &gozel.ZeModuleDesc{
_, err := gozel.ZeModuleCreate(gozel.ZeContextHandle(h), gozel.ZeDeviceHandle(hDevice), &gozel.ZeModuleDesc{
Stype: gozel.ZE_STRUCTURE_TYPE_MODULE_DESC,
Format: gozel.ZE_MODULE_FORMAT_IL_SPIRV,
Inputsize: uintptr(len(data)),