PXL
type.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: Apache-2.0
2
// Copyright 2024 XCENA Inc.
3
4
#pragma once
5
6
#include <cstddef>
7
#include <cstdint>
8
#include <
pxl/v3_api_guard.hpp
>
9
10
namespace
pxl
11
{
12
13
enum class
ExecuteStatus
14
{
15
Idle
= 0,
16
HostInit
,
17
DeviceInit
,
18
Request
,
19
Waiting
,
20
DeviceFinalize
,
21
HostFinalize
,
22
Fail
,
23
Cancelled
,
24
Completed
,
25
Max
26
};
27
28
enum class
ArgType
29
{
30
Constant
,
31
DeviceMemory
,
32
NDArray
,
33
};
34
35
struct
ArgInfo_t
36
{
37
ArgType
type
;
38
const
void
*
addr
;
39
size_t
size
;
40
};
41
42
struct
KernelError_t
43
{
44
uint32_t
beginIndex
;
45
uint32_t
endIndex
;
46
};
47
48
struct
Progress_t
49
{
50
uint32_t
targetCount
;
// total packets the map will dispatch for this run
51
uint32_t
issuedCount
;
// packets already sent to the device
52
uint32_t
doneCount
;
// packets the device has reported complete
53
};
54
62
struct
MemoryUsage_t
63
{
64
uint64_t
available
= 0;
// allocatable now, by any process
65
uint64_t
releasing
= 0;
// released, allocatable once flushed
66
uint64_t
used
= 0;
// held by processes, plus freed memory a failed flush keeps from reuse
67
};
68
69
enum class
Result
70
{
71
Success
= 0,
72
Failure
,
// generic failure; prefer a specific category below when the cause is known
73
Pending
,
74
// --- error categories (keep Success/Failure/Pending values stable; append only) ---
75
InvalidArgument
,
// malformed/contradictory caller input or object state
76
DeviceError
,
// HW/driver-level failure reported by xif
77
NotFound
,
// module/symbol/resource lookup miss
78
Timeout
,
// operation did not complete in time (e.g. waitEvent)
79
NotSupported
,
// unsupported request/configuration
80
NotInitialized
,
// library/context/device not initialized
81
Cancelled
,
// operation cancelled before completion
82
Internal
,
// internal invariant violated / unreachable (a PXL bug); always logged
83
// NOTE: memory-shortage failures are intentionally NOT represented here. They
84
// surface through the standalone memory API's MemoryStatus (memory.hpp), which
85
// is self-contained (no Result dependency) so the device can serve memory in
86
// InfiniteMemory mode without installing the full PXL library.
87
Count
,
// number of values; sentinel for iteration/tests, not a real status
88
};
89
90
// Returns a stable, human-readable name for a Result code (akin to cudaGetErrorString).
91
// Never returns nullptr. The returned string is statically allocated.
92
const
char
*
resultString
(
Result
result) noexcept;
93
94
enum class
DeviceAttr
95
{
96
InfiniteMemory
,
97
NumClusterPerSub
,
98
NumMuCorePerCluster
,
99
TotalSubCount
,
100
CxlMemoryCapacity
,
101
// Job::remapMemory alignment. Reports NotSupported on devices that cannot
102
// remap (InfiniteMemory / non-CXL), so a successful query means remap is usable.
103
MappingGranularity
104
};
105
106
enum class
LocalityMode
: uint32_t
107
{
108
CompactMode
= 0,
109
SpreadMode
110
};
111
112
static
constexpr uint32_t MaxTaskCount = (1 << 20) - 1;
113
114
}
// namespace pxl
pxl
Definition:
config.hpp:13
pxl::ArgType
ArgType
Definition:
type.hpp:29
pxl::ArgType::NDArray
@ NDArray
pxl::ArgType::DeviceMemory
@ DeviceMemory
pxl::ArgType::Constant
@ Constant
pxl::resultString
const char * resultString(Result result) noexcept
pxl::Result
Result
Definition:
type.hpp:70
pxl::Result::InvalidArgument
@ InvalidArgument
pxl::Result::Pending
@ Pending
pxl::Result::NotFound
@ NotFound
pxl::Result::Success
@ Success
pxl::Result::NotInitialized
@ NotInitialized
pxl::Result::NotSupported
@ NotSupported
pxl::Result::Cancelled
@ Cancelled
pxl::Result::Internal
@ Internal
pxl::Result::DeviceError
@ DeviceError
pxl::Result::Timeout
@ Timeout
pxl::Result::Failure
@ Failure
pxl::Result::Count
@ Count
pxl::LocalityMode
LocalityMode
Definition:
type.hpp:107
pxl::LocalityMode::SpreadMode
@ SpreadMode
pxl::LocalityMode::CompactMode
@ CompactMode
pxl::ExecuteStatus
ExecuteStatus
Definition:
type.hpp:14
pxl::ExecuteStatus::Completed
@ Completed
The most recent execution completed successfully.
pxl::ExecuteStatus::Request
@ Request
pxl::ExecuteStatus::DeviceFinalize
@ DeviceFinalize
pxl::ExecuteStatus::Waiting
@ Waiting
pxl::ExecuteStatus::Max
@ Max
pxl::ExecuteStatus::Cancelled
@ Cancelled
pxl::ExecuteStatus::HostInit
@ HostInit
pxl::ExecuteStatus::Fail
@ Fail
pxl::ExecuteStatus::Idle
@ Idle
Initial state before the first execution.
pxl::ExecuteStatus::HostFinalize
@ HostFinalize
pxl::ExecuteStatus::DeviceInit
@ DeviceInit
pxl::DeviceAttr
DeviceAttr
Definition:
type.hpp:95
pxl::DeviceAttr::NumMuCorePerCluster
@ NumMuCorePerCluster
pxl::DeviceAttr::NumClusterPerSub
@ NumClusterPerSub
pxl::DeviceAttr::InfiniteMemory
@ InfiniteMemory
pxl::DeviceAttr::CxlMemoryCapacity
@ CxlMemoryCapacity
pxl::DeviceAttr::TotalSubCount
@ TotalSubCount
pxl::DeviceAttr::MappingGranularity
@ MappingGranularity
pxl::ArgInfo_t
Definition:
type.hpp:36
pxl::ArgInfo_t::addr
const void * addr
Definition:
type.hpp:38
pxl::ArgInfo_t::type
ArgType type
Definition:
type.hpp:37
pxl::ArgInfo_t::size
size_t size
Definition:
type.hpp:39
pxl::KernelError_t
Definition:
type.hpp:43
pxl::KernelError_t::endIndex
uint32_t endIndex
Definition:
type.hpp:45
pxl::KernelError_t::beginIndex
uint32_t beginIndex
Definition:
type.hpp:44
pxl::MemoryUsage_t
A device's CXL memory by state, in bytes (Context::memoryUsage()).
Definition:
type.hpp:63
pxl::MemoryUsage_t::releasing
uint64_t releasing
Definition:
type.hpp:65
pxl::MemoryUsage_t::used
uint64_t used
Definition:
type.hpp:66
pxl::MemoryUsage_t::available
uint64_t available
Definition:
type.hpp:64
pxl::Progress_t
Definition:
type.hpp:49
pxl::Progress_t::issuedCount
uint32_t issuedCount
Definition:
type.hpp:51
pxl::Progress_t::targetCount
uint32_t targetCount
Definition:
type.hpp:50
pxl::Progress_t::doneCount
uint32_t doneCount
Definition:
type.hpp:52
v3_api_guard.hpp
include
v3
pxl
type.hpp
Generated by
1.9.1