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
9
namespace
pxl
10
{
11
12
enum class
ExecuteStatus
13
{
14
Idle
= 0,
15
HostInit
,
16
DeviceInit
,
17
Request
,
18
Waiting
,
19
DeviceFinalize
,
20
HostFinalize
,
21
Fail
,
22
Cancelled
,
23
Completed
,
24
Max
25
};
26
27
enum class
ArgType
28
{
29
Constant
,
30
DeviceMemory
,
31
NDArray
,
32
};
33
34
struct
ArgInfo_t
35
{
36
ArgType
type
;
37
const
void
*
addr
;
38
size_t
size
;
39
};
40
41
struct
KernelError_t
42
{
43
uint32_t
beginIndex
;
44
uint32_t
endIndex
;
45
};
46
47
struct
Progress_t
48
{
49
uint32_t
targetCount
;
// total packets the map will dispatch for this run
50
uint32_t
issuedCount
;
// packets already sent to the device
51
uint32_t
doneCount
;
// packets the device has reported complete
52
};
53
54
enum class
Result
55
{
56
Success
= 0,
57
Failure
,
// generic failure; prefer a specific category below when the cause is known
58
Pending
,
59
// --- error categories (keep Success/Failure/Pending values stable; append only) ---
60
InvalidArgument
,
// malformed/contradictory caller input or object state
61
DeviceError
,
// HW/driver-level failure reported by xif
62
NotFound
,
// module/symbol/resource lookup miss
63
Timeout
,
// operation did not complete in time (e.g. waitEvent)
64
NotSupported
,
// unsupported request/configuration
65
NotInitialized
,
// library/context/device not initialized
66
Cancelled
,
// operation cancelled before completion
67
Internal
,
// internal invariant violated / unreachable (a PXL bug); always logged
68
// NOTE: memory-shortage failures are intentionally NOT represented here. They
69
// surface through the standalone memory API's MemoryStatus (memory.hpp), which
70
// is self-contained (no Result dependency) so the device can serve memory in
71
// InfiniteMemory mode without installing the full PXL library.
72
Count
,
// number of values; sentinel for iteration/tests, not a real status
73
};
74
75
// Returns a stable, human-readable name for a Result code (akin to cudaGetErrorString).
76
// Never returns nullptr. The returned string is statically allocated.
77
const
char
*
resultString
(
Result
result) noexcept;
78
79
enum class
DeviceAttr
80
{
81
InfiniteMemory
,
82
NumClusterPerSub
,
83
NumMuCorePerCluster
,
84
TotalSubCount
,
85
CxlMemoryCapacity
,
86
// Job::remapMemory alignment. Reports NotSupported on devices that cannot
87
// remap (InfiniteMemory / non-CXL), so a successful query means remap is usable.
88
MappingGranularity
89
};
90
91
enum class
LocalityMode
: uint32_t
92
{
93
CompactMode
= 0,
94
SpreadMode
95
};
96
97
static
constexpr uint32_t MaxTaskCount = (1 << 20) - 1;
98
99
}
// namespace pxl
pxl
Definition:
config.hpp:11
pxl::ArgType
ArgType
Definition:
type.hpp:28
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:55
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:92
pxl::LocalityMode::SpreadMode
@ SpreadMode
pxl::LocalityMode::CompactMode
@ CompactMode
pxl::ExecuteStatus
ExecuteStatus
Definition:
type.hpp:13
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:80
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:35
pxl::ArgInfo_t::addr
const void * addr
Definition:
type.hpp:37
pxl::ArgInfo_t::type
ArgType type
Definition:
type.hpp:36
pxl::ArgInfo_t::size
size_t size
Definition:
type.hpp:38
pxl::KernelError_t
Definition:
type.hpp:42
pxl::KernelError_t::endIndex
uint32_t endIndex
Definition:
type.hpp:44
pxl::KernelError_t::beginIndex
uint32_t beginIndex
Definition:
type.hpp:43
pxl::Progress_t
Definition:
type.hpp:48
pxl::Progress_t::issuedCount
uint32_t issuedCount
Definition:
type.hpp:50
pxl::Progress_t::targetCount
uint32_t targetCount
Definition:
type.hpp:49
pxl::Progress_t::doneCount
uint32_t doneCount
Definition:
type.hpp:51
include
pxl
type.hpp
Generated by
1.9.1